c语言编写:给定存储了N个从大到小排好序的整数数组Data[].试将任一给定整数X
1个回答
关注
展开全部
您好,上述问题将由我为您进行解答。
#include
int main() {
int a[50], n, i, j, t;
printf("input n:");
scanf("%d", &n);
printf("input %d numbers:\n", n);
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
printf("The sorted numbers are:\n");
for (i = 0; i < n; i++) {
for (j = i + 1; j < n; j++) {
if (a[i] > a[j]) {
t = a[i];
a[i] = a[j];
a[j] = t;
}
}
}
printf("The sorted numbers are:\n");
for (i = 0; i < n; i++) {
printf("%d ", a[i]);
}
return 0;
详情链接:https://blog.csdn.net/liusir_M/article/details/120386561 希望能帮助的到您!
咨询记录 · 回答于2023-12-22
c语言编写:给定存储了N个从大到小排好序的整数数组Data[].试将任一给定整数X
题目是:给定存储了N个从大到小排好序的整数数组Data[].试将任一给定整数X插入数组中合适的位置,以保持结果依然有序。
您好,上述问题将由我为您进行解答。
#include
int main() {
int a[50],n,i,j,t;
printf("input n:");
scanf("%d",&n);
printf("input %d numbers:\n",n);
for(i=0;i
您好,上述问题将由我为您进行解答。详情链接:https://blog.csdn.net/liusir_M/article/details/120386561 希望能帮助的到您!