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

RESTful APIs with CRUD Operations in Laravel 12| (2025)

  RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

Powered by Blogger.