// YOUR CODE GOES HERE
        // Please take input and print output to standard input/output (stdin/stdout)
        // DO NOT USE ARGUMENTS FOR INPUTS
        // E.g. 'Scanner' for input & 'System.out' for output
import java.lang.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {      
        Scanner scn = new Scanner(System.in); 
        int N = scn.nextInt();
        int[] arr = new int[N];
        //take input for array element 
        for (int i =0; i<arr.length; i++  ) {            
            arr[i] = scn.nextInt();
        }

        int min = arr[0]; int max = arr[0] ;
         for (int i =1; i<arr.length; i++  ) {            
            if ( max < arr[i])
                max = arr[i] ;
            if (min > arr[i])  
                min = arr[i];
        }
        
        System.out.println( max +" "+min) ;
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: