C语言实现:求10 个整数中最大值

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;
}

运行结果如下:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_44779591/article/details/88644912