#include <stdio.h>

void main() {
	int temp, i, j;
	int arr[] = { 55,07,78,12,42 };

	for (i = 4; i >= 1; i--) {
		for (j = 1; j <= i; j++)
			if (arr[j - 1] > arr[j]) {
				temp = arr[j - 1];
				arr[j - 1] = arr[j];
				arr[j] = temp;
			}
	}

	for (i = 0; i < 5; i++)
	printf("%d\n", arr[i]);

	return 0;
}
Retrieved from http://wiki.zeropage.org/wiki.php/새싹교실/2017/내무반/박채린/BubbleSort
last modified 2021-02-07 05:30:06