1 #include <stdio.h>
2
3 int main()
4 {
5 int a[] = {3,2,4,5,3,8};
6 for(int i = 1; i < sizeof(a)/sizeof(int); i++)
7 {
8 for(int j = i; j > 0 && a[j] < a[j-1]; j--)
9 {
10 int temp = a[j];
11 a[j] = a[j-1];
12 a[j-1] = temp;
13 }
14 }
15 for(int i = 0; i < sizeof(a)/sizeof(int); i++)
16 {
17 printf("%-3d", a[i]);
18 }
19 printf("\n");
20 return 0;
21 }
22