public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(true){
System.out.println("输入三个数字,以空格隔开");
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
if(a > b ){
int temp = a;
a = b;
b = temp;
}
if(a > c ){
int temp = a;
a = c;
c = temp;
}
if(b > c){
int temp = b;
b = c;
c = temp;
}
System.out.println("从小到大的顺序为:"+a+" "+b+" "+c);
}
} |