//15题
import java.util.Scanner;
public class daxiao {
public static void main(String[] args){
Scanner sc= new Scanner(System.in);
int a,b,c;
System.out.print("请输入第一个数:");
a= sc.nextInt();
System.out.print("请输入第二个数:");
b= sc.nextInt();
System.out.print("请输入第三个数:");
c= sc.nextInt();
while(true){
int temp=0;
if(a>b){
temp = a;
a = b;
b = temp;
}
if(b>c){
temp = b;
b = c;
c = temp;
}
if(a<b&&b<c){//如果不成立就继续循环下去
break;
}
}
System.out.println("由小到大:" + a + ", " +b+", "+ c );
}
} |