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 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

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

Powered by Blogger.