美文网首页JAVA
输入数字比较其大小

输入数字比较其大小

作者: TY_ | 来源:发表于2016-08-09 10:27 被阅读15次
Paste_Image.png
public class Max_or_min {
    public static void main(String[] args) {
        int[] s = { 45, 29, 37 };
        int a, b, c, d;
        a = s[0];
        b = s[1];
        c = s[2];
        if (a > b) {
            d = b;
            b = c;
            c = d;
        }
        if (a > c) {
            d = c;
            c = a;
            a = d;
        }
        if (b > c) {
            d = c;
            c = a;
            a = d;
        }
        System.out.println("MAX:" + c + "\r" + "MIN:" + a);
    }
}

相关文章

网友评论

    本文标题:输入数字比较其大小

    本文链接:https://www.haomeiwen.com/subject/kjxdsttx.html