#include <stdio.h>
int main() {
int a[6] = {1, 1, 4, 5, 1, 4};
int tmp;
// バブルソート
for (int _ = 0; _ < 10; _++) {
for (int i = 0; i < 5; i++) {
if (a[i] > a[i+1]) { // 降順
tmp = a[i];
a[i] = a[i+1];
a[i+1] = tmp;
}
}
}
// 出力
for (int i = 0; i < 6; i++) {
printf("%d\n", a[i]);
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: