import java.util.*;
class usingand
{
public static void main (String arg[])
{
Scanner in = new Scanner (System.in);
int a,b,c;
System.out.print ("\n\t Enter value of a = ");
a=in.nextInt();
System.out.print ("\n\t Enter value of b = ");
b=in.nextInt();
System.out.print ("\n\t Enter value of c = ");
c=in.nextInt();
if (a>b && a>c)
System.out.println ("\n\t a is greatest ");
else if (b>a && b>c)
System.out.println ("\n\t b is greatest ");
else
System.out.println ("\n\t c is greatest ");
}
}
In this program, once you have entered values, first statement will be executed
- If 'a' is greater than both 'b' and 'c'
- If 'b' is greater than both 'a' and 'c'
"c is greatest"
No comments:
Post a Comment