Search for the maximum element in an array
C#
Easy
arrays
Task «Search for the maximum element in an array»
Write a program that finds the maximum element in an array of integers. The array is entered from the keyboard: first the number of elements is entered, then the elements themselves. Print the maximum value.
Input Format
First line — integer N (1 ≤ N ≤ 1000). Second line — N integers separated by spaces.
Output Format
One integer — the maximum element of the array.
Examples
Example 1
INPUT
4
2 4 6 8
OUTPUT
8
Example 2
INPUT
3
-5 10 15
OUTPUT
15
main.cs