求十个整数的最大值

#include<stdio.h>
#include<stdlib.h>
int main()
{
    int arr[10] = { 2,3,5,7,4,6,8,1,9,0 };
    int max = arr[0];
    int n = 0;
    for (n = 0; n <= 9; n++)
    {
        if (arr[n] > max)
        {
            max = arr[n];
        }
    }
    printf("%d\n", max);
    system("pause");
    return 0;
}
注释:直接在程序中输入10个数

猜你喜欢

转载自blog.csdn.net/qq_42881272/article/details/88652668