1 #include<stdio.h> 2 3 int main(void) 4 { 5 int n; 6 int number[10]; 7 8 scanf_s("%d", &n); 9 10 for (int i = 0; i < n; i++) 11 { 12 scanf_s("%d", &number[i]); 13 } 14 15 for (int i = 0; i < n - 1; i++) 16 { 17 int index = i; 18 for (int j = i + 1; j < n; j++) 19 { 20 if (number[j] > number[index]) 21 { 22 index = j; 23 } 24 } 25 if (i != index) 26 { 27 int temp; 28 temp = number[i]; 29 number[i] = number[index]; 30 number[index] = temp; 31 } 32 } 33 for (int i = 0; i < n; i++) 34 { 35 if (i == 0) 36 { 37 printf("%d", number[i]); 38 } 39 else 40 { 41 printf(" %d", number[i]); 42 } 43 } 44 45 printf(" "); 46 47 return 0; 48 }