#include <stdio.h>
int main() {
int i, j, temp = 0, max, a[5] = {2, 5, 4, 1, 3};
for (j = 0; j < 5 - 1; j++) {
max = j;
for (i = j + 1; i < 5; i++) {
if (a[max] < a[i])
max = i;
}
temp = a[max];
a[max] = a[j];
a[j] = temp;
}
for (j = 0; j < 5; j++)
printf("%d", a[j]);
return 0;
}
04-24
4万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-26
6640
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交