SHARE
TWEET

Untitled

a guest Jan 20th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. package lab;
  3. import java.util.Scanner;
  4.  
  5. public class Lab {
  6.  
  7.     public static void main(String[] args) {
  8.         System.out.println("Enter How many elements do you want to enter?");
  9.       Scanner input=new Scanner(System.in);
  10.       int n=input.nextInt();
  11.       int[]arr=new int[n];
  12.    
  13.         System.out.println("Enter elements");
  14.         for(int i=0;i<arr.length;i++)
  15.         {
  16.             arr[i]=input.nextInt();
  17.                    
  18.     }
  19.           int max=arr[0];
  20.         for(int i=1;i<arr.length;i++)
  21.         {
  22.             if(arr[i]>max)
  23.             {
  24.                 max=arr[i];
  25.                
  26.             }
  27.            
  28.     }
  29.         System.out.println(" "+max);
  30.    
  31. }
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top