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