public class work4 {
public static void main(String[] args) {
int num1, num2,num3;
Scanner ss = new Scanner(System.in);
System.out.println("请输入第一个数:");
num1 = ss.nextInt();
System.out.println("请输入第二个数:");
num2 = ss.nextInt();
System.out.println("请输入第三个数:");
num3 = ss.nextInt();
if (num1<= num2&&num2<=num3&&num1<= num3) {
System.out.println("从小到大排列为:" + num1 + num2 + num3);
}
if (num1<= num2&&num1<=num3&&num3<= num2) {
System.out.println("从小到大排列为:" + num1 + num3 + num2);
}
if (num3<= num2&&num2<=num1&&num3<= num1) {
System.out.println("从小到大排列为:" + num3 + num2 + num1);
}
if (num3 <= num2&&num3<=num1&&num1<= num2) {
System.out.println("从小到大排列为:" + num3 + num1 + num2);
}
if (num2<= num3&&num3<=num1&&num2<= num1) {
System.out.println("从小到大排列为:" + num2 + num3 + num1);
}
if (num2<= num1&&num2<=num3&&num1<= num3){
System.out.println("从小到大排列为:" + num2+num1+num3);
}
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)