package HomeWork;
import java.util.Scanner;
public class Test06 {
static Scanner in = new Scanner(System.in);
public static void main(String[] args) {
// TODO Auto-generated method stub
T3();
}
public static void T1(){
System.out.print("请输入第一个数字:");
int num1 = in.nextInt();
System.out.print("请输入第二个数字:");
int num2 = in.nextInt();
int max = num1>num2? num1:num2;
System.out.println("这两个数字中最大的数是:"+max);
}
public static void T2(){
System.out.print("请输入第一个数字:");
int num1 = in.nextInt();
System.out.print("请输入第二个数字:");
int num2 = in.nextInt();
System.out.print("请输入第三个数字:");
int num3 = in.nextInt();
int max = (num1>num2?num1:num2)>num3?(num1>num2?num1:num2):num3;
System.out.println("这两个数字中最大的数是:"+max);
}
public static void T3(){
int a[] = new int[3];
for(int i = 0;i<3;i++){
System.out.print("请输入第"+(i+1)+"个数字");
a[i] = in.nextInt();
}
int t;
//排序
for(int i = 0;i<3;i++){
for(int j = 0;j<2-i;j++){
if(a[j]<a[j+1]){
t = a[j];
a[j] = a[j+1];
a[j+1] = t;
}
}
}
System.out.println("这些数字从大到小排序是:");
for(int i = 0;i<3;i++){
System.out.print(a[i]+" ");
}
}
}