package aRray;
import java.util.*;
public class practicalArray {
// check gratest number
public static int greatestNumber(int size, int []arr, int max) {
for(int i = 0 ; i < size; i++) {
if(arr[i] > max) {
max = arr[i];
}
}
return max;
}
public static void main(String [] args) {
Scanner scan = new Scanner(System.in);
int size = scan.nextInt();
int arr [] = new int[size];
int max = 0;
for(int i = 0 ; i < size; i++) {
arr[i] = scan.nextInt();
}
int result = greatestNumber(size, arr, max );
System.out.println(result);
}
}
Comments
Post a Comment