import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter");
int a = s.nextInt();
int b = s.nextInt();
int c = s.nextInt();
if (a > b) {//当a>b时,a和b的值互换
int t = a;
a = b;
b = t;
}
if (a > c) {//当a>c时,a和b的值互换
int t = a;
a = c;
c = t;
}
if (b > c) {//当b>c时,a和b的值互换
int t = b;
b = c;
c = t;
}
System.out.println("");
System.out.println(a + " " + b + " " + c);
}
}
Java中输入3个整数并且实现按从小到大排序输出
最新推荐文章于 2024-10-03 09:26:08 发布