求十个数中最大值

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i;
int max;
int tmp;
scanf("%d", &max);//max是十个数其中的一个值,所以后面循环中只有九次
for (i = 1; i < 10; i++)
{
scanf("%d", &tmp);
if (tmp> max)
{
max = tmp;
}
}

printf("%d\n", max);
system("pause");
return 0;

}

猜你喜欢

转载自blog.csdn.net/qq_44840046/article/details/89366758