import java.io.*; public class ArrayMinMax { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("ENTER THE NUMBER OF ELEMENTS"); int n = Integer.parseInt(br.readLine()); int arr[] = new int[n]; System.out.println("ENTER THE INTEGERS"); for (int i = 0; i < n; i++) { arr[i] = Integer.parseInt(br.readLine()); } int max = arr[0]; int min = arr[0]; for (int j = 1; j < n; j++) { if (arr[j] > max) { max = arr[j]; } if (arr[j] < min) { min = arr[j]; } } System.out.println("MAXIMUM NUMBER = " + max); System.out.println("MINIMUM NUMBER = " + min); } }