1169 Problem R "C Programming Language" Jiang Po Kushiro editor --5-3- maximum dynamic exercises

Problem Description

Enter a positive integer n, the maximum number of the input integer n, the number n of output

Entry

The first line n
second row number n

Export

The maximum number of

Sample input

10
1 2 3 4 5 6 7 8 9 10

Sample Output

10

AC Code

#include <iostream>

using namespace std;

int main()
{
    int n;
    int a[100];
    int a_max = 0;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        if(a[i] > a_max)
        {
            a_max = a[i];
        }
    }
    cout << a_max<< endl;
    return 0;
}
Published 119 original articles · won praise 28 · views 40000 +

Guess you like

Origin blog.csdn.net/weixin_41179709/article/details/103964609