0
How to use ternary operator to find greatest no of 3 numbers
3 Answers
+ 1
int a=5,b=1,c=3;
int max=a;
int max2=b>max ? b:max;
System.out.println(c>max2?c:max2 );
0
int x = 2;
int y = 4;
int z = 3;
int max = x > y? (x > z?x:z):(z>y?z:y);
should work...
0
thanks