#include <stdio.h>

#define N 20

int main()
{
    int a[N] = {
        45, 12, 78, 3, 56,
        29, 91, 17, 64, 8,
        33, 70, 1, 52, 86,
        24, 39, 95, 11, 60
    };

    int i, j, temp;

    printf("排序前的数据：\n");
    for(i = 0; i < N; i++)
        printf("%d ", a[i]);

    // 冒泡排序
    for(i = 0; i < N - 1; i++)
    {
        for(j = 0; j < N - 1 - i; j++)
        {
            if(a[j] > a[j + 1])
            {
                temp = a[j];
                a[j] = a[j + 1];
                a[j + 1] = temp;
            }
        }
    }

    printf("\n\n冒泡排序后的数据：\n");
    for(i = 0; i < N; i++)
        printf("%d ", a[i]);

    return 0;
}