Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import java.util.Scanner; public class Main { static final int LIMIT = 10; public static void main (String[] arg) { Scanner sc = new Scanner(System.in); int[] num = new int[LIMIT]; int temp = 0; for (int i=0; i<LIMIT; i++) num[i] = sc.nextInt(); for (int i=0; i<LIMIT; i++) { for (int j=i; j<LIMIT; j++) { if (num[i] < num[j]) { temp = num[i]; num[i] = num[j]; num[j] = temp; } } } for (int n : num) System.out.print(n + " "); } } | cs |