Example code for finding largest of three numbers using ternary operator:
Find the output of this program?
int res, a=4, b=12, c =3;
res = ( a > b ? ( a > c ? a: c ) : ( b > c ? b: c ) ) ;
compile time error
This is the logic to find the biggest of 3 numbers using ternary operator. Output is "12".
can you please explain how res:(a>b?(a>c?a:c):(b>c?b:c) code working
Back To Top