C语言实现:求10 个整数中最大值
程序如下:
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
int i, j, max, arr[10];
for (i = 0; i < 10; i++)
scanf("%d", &arr[i]);
max = arr[0];
for (i = 1; i < 10; i++)
{
if (arr[i]>max)
max = arr[i];
}
printf(“max is %d”, max);
system(“pause”);
return 0;
}
运行结果如下: