11. Write a program in java to input 10 integer number. Find a largest number out of 10 input numbers?

import java.io.DataInputStream;
class Largest
{
                public static void main(String args[])
                {
                                DataInputStream in=new DataInputStream(System.in);
                                int l=0,j=0,c=0;
                                try
                                {
                                                System.out.println("Enter Ten Integer Number : ");
                                                for(c=0;c<10;c++)
                                                {
                                                                j=Integer.parseInt(in.readLine());
                                                                if(j>l)
                                                                                l=j;
                                                }
                                }
                                catch(Exception e) {}
                                System.out.println("Largest Number = "+l);
                }
}

JAVA 11.PNG

Advertisements

Comments are closed.

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: