Max Number In Array

 Write a Program to take Array of values,and print the Maximum number in an Array.

Input Format:

  • First line take an Integer input from stdin which is array length n.
  • Second line take n Integers which is inputs of array .

Output Format:

Print the Integer which is maximum value in an array.

Example Input:

5
2 3 1 5 4

Output:

5

Example Input:

6
1 3 7 6 2 4

Output:

7


Solution:


n=int(input())

e=input().split()

if(n==len(e)):

    for i in range(n):

        e[i]=int(e[i])  

    e.sort()

    print(e[-1])   #last element of list

  



Comments

Popular posts from this blog

Right Arrow Pattern

Efficient Janitor

X Pattern