#include<stdio.h> void main() { int a[10]; for (int i = 0; i < 10; i++) { scanf("%d", &a[i]); } int temp; for (int i = 0; i < 9; i++) { for (int j = i + 1; j < 10; j++) { if (a[i] > a[j]) { temp = a[i]; a[i] = a[j]; a[j] = temp; } } } for (int i = 0; i < 10; i++) { printf("%d\n", a[i]); } } |
Double click to view unformatted code.