Code Box
-------------------------------------
/* Program to print greater number in 3 numbers using
conditional operator in command line argument */
class greaterc3
{
public static void main(String x[])
{
int a,b,c;
String s;
a=Integer.parseInt(x[0]);
b=Integer.parseInt(x[1]);
c=Integer.parseInt(x[2]);
s=(a>b && b>c)?"a is greater a="+a:((b>c)?"b is grater b="+b:"c is grater c="+c);
System.out.print("\n"+s);
}
}
0 comments:
Post a Comment