U E D R , A S I H C RSS

새싹교실/2017/내무반/박채린/Bubble Sort

Difference between r1.2 and the current

@@ -1,3 +1,4 @@
{{{
#include <stdio.h>

void main() {
@@ -18,3 +19,4 @@

return 0;
}
}}}



#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;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:30:06
Processing time 0.0324 sec