import java.util.Scanner;
public class Sort {
public static void main(String[] args){
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("Please enter a: ");
a = input.nextInt();
System.out.print("Please enter b: ");
b = input.nextInt();
System.out.print("Please enter c: ");
c = input.nextInt();
if(a>b){
if(c>a) {
System.out.println(c+" "+a+" "+b);
}
else if(b>c){
System.out.println(a+" "+b+" "+c);
}
else{
System.out.println(a+" "+c+" "+b);
}
}
else{
if(c<a){
System.out.println(b+" "+a+" "+c);
}
else if(c>b){
System.out.println(c+" "+b+" "+a);
}
else{
System.out.println(b+" "+c+" "+a);
}
}
}
}
编写程序,提示用户输入三个整数。以非降序的形式显示这三个整数。
最新推荐文章于 2022-10-13 22:29:43 发布