#include<stdio.h>
int main() {
int arr[10] = { 1, 77, 31, 4, 500, 6, 7, 8, 9, 10 };
int x=0;int i = arr[x];//目的是将大的数据储存在i里面
for (x = 0; x < 9; x++) {
if (i>arr[x + 1]){
;//i大则不变
}
else {
i = arr[x + 1];//i小了 需要更新i
}
}
printf("%d\n", i);
system(“pause”);
return 0;
}
求一个数组中最大值
最新推荐文章于 2022-10-18 20:08:36 发布