0
1.3kviews
Write a program to find the largest of the 3 integer accepted from command line.

Mumbai University > Information Technology > Sem 3 > Object Oriented Programming Methodology

Marks: 5M

Year: May 2014

1 Answer
0
1views
import java.io.*;
     class command
     {
        public static void main(String args[])
        {
           int a,b,c;
           a=Integer.parseInt(args[0]);   //converting String to Integer
           b=Integer.parseInt(args[1]);
           c=Integer.parseInt(args[2]);

if((a>b) && (a>c))      //comparing 1st number with other 2 numbers
System.out.println(a + " is greatest");
else if((b>a) && (b>c))  //comparing 2nd number with other 2 numbers
System.out.println(b +" is greatest");
else
System.out.println(c +" is greatest");
       }
  }
Please log in to add an answer.