C语言的简单排序方法:大数上浮,下数下沉.
//定义一个数组
int num[10] = {11,2,33,44,22,12,45,67,9,13};
for (int i = 0; i < 10; ++i) {
for (int j = 0; j < 10 ; ++j) {
if (num[i] < num[j]) {
int temp = num[i];
num[i] = num[j];
num[j] = temp;
}
}
}
for (int i = 0; i < 10; ++i) {
printf("%d,", num[i]);
}