1 #include <stdio.h>
2
3 int main()
4 {
5 int a[] = {89, 56, 1, 84, 64, 6, 5, 13};
6 int i, j, k = sizeof(a)/sizeof(a[0]);
7 for(i = 0; i < sizeof(a)/sizeof(a[0]); i++, k--)
8 {
9 for(j = 0; j < k - 1; j++)
10 {
11 int t;
12 if(a[j] > a[j+1])
13 {
14 t = a[j];
15 a[j] = a[j+1];
16 a[j+1] = t;
17 }
18 }
19 }
20
21 for(i = 0;i < sizeof(a)/sizeof(a[0]); i++)
22 printf("%d ", a[i]);
23
24 return 0;
25 }