import java.util.Scanner; / public class Test01 { public static void main(String[] args) { System.out.println("随意输入三个数字"); Scanner s1 = new Scanner(System.in); int i = s1.nextInt(); Scanner s2 = new Scanner(System.in); int j = s2.nextInt(); Scanner s3 = new Scanner(System.in); int k = s3.nextInt(); System.out.println("你输入的三个数字是"+ i+"," + j +","+ k); int [] arr = new int [] {i,j,k}; for(int q = 0;q <arr.length;q++){ for(int w = 0;w <arr.length-1;w++){ if(arr[q] < arr[w]){ int temp = arr[q]; arr[q] = arr[w]; arr[w] = temp; } } } for(int q = 0;q < arr.length;q++){ System.out.print(arr[q] + ","); } } } |