import java.io.DataInputStream;
class Test
{
                public static void main(String args[])
                {
                                DataInputStream in=new DataInputStream(System.in);
                                int n[],x,i,l=0;
                                try
                                {
                                                System.out.println("Enter Size of Array : ");
                                                x=Integer.parseInt(in.readLine());
                                                n=new int[x];
                                                for(i=0;i<x;i++)
                                                                n[i]=Integer.parseInt(in.readLine());
                                                for(i=0;i<x;i++)
                                                                if(n[i]>l)
                                                                                l=n[i];
                                }
                                catch(Exception e) {}
                                System.out.println("Largest No = "+l);
                }
}

JAVA 21.PNG

Advertisements