题解 | #最大最小值#

最大最小值

https://ac.nowcoder.com/acm/problem/22015

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = 0;
        int b = 0;
        int c = 0;
        while (in.hasNext()) {
            a = in.nextInt();
            b = in.nextInt();
            c = in.nextInt();
        }
        
        int max = a;
        int min = a;
        
        if (a <= b) {
            max = b;
        } else {
            min = b;
        }
        
        if (max <= c) {
            max = c;
        } 
        if (min >= c) {
            min = c;
        }

        System.out.println("The maximum number is : " + max);
        System.out.println("The minimum number is : " + min);
    }
}
全部评论

相关推荐

被加薪的哈里很优秀:应该继续招人,不会给你留岗位的
点赞 评论 收藏
分享
野猪不是猪🐗:现在的环境就是这样,供远大于求。 以前卡学历,现在最高学历不够卡了,还要卡第一学历。 还是不够筛,于是还要求得有实习、不能有gap等等... 可能这个岗位总共就一个hc,筛到最后还是有十几个人满足这些要求。他们都非常优秀,各方面都很棒。 那没办法了,看那个顺眼选哪个呗。 很残酷,也很现实
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务