https://www.acmicpc.net/problem/2750
Idea
https://www.geeksforgeeks.org/bubble-sort/
Bubble Sort 구현
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void) {
int arr[1001] = { 0, };
int N, temp = 0;
scanf("%d", &N);
for (int i = 0; i < N; i++) {
scanf("%d", &arr[i]);
}
for (int i = 0; i < N - 1; i++) {
for (int j = 1; j < N - i; j++) {
if (arr[j - 1] > arr[j]) {
temp = arr[j];
arr[j] = arr[j - 1];
arr[j - 1] = temp;
}
}
}
for (int i = 0; i < N; i++) {
printf("%d\n", arr[i]);
}
return 0;
}