Toph easy problem(Maximum)

Question:

Maximum

Limits: 1s, 512 MB

Given N numbers, find the one that is of the highest value and print it.

Input

The first line of the input will contain N (N < 100).
The following line will contain N integers, each between 1 and 1000.

Output

Print the maximum.

Samples

InputOutput
3
4 2 7

Solve in C:

#include<stdio.h>
int main(){

int n,max=0,i,ar[100];
scanf("%d",&n);
for(i=1;i<=n;i++)
{
    scanf("%d",&ar[i]);
    {
        if(ar[i]>max)
        {
            max=ar[i];
        }
    }
}
printf("%d\n",max);


}

7

No comments

Most View Post

Recent post

Codeforces Round 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.