Rewrite the snippet using Ternary operators:
if(a<b) { c=(a+b); } else { c=(a-b); }
67 Likes
c = a < b ? (a + b) : (a - b);
Answered By
36 Likes
Predict the output:
int a=6,b=5; a += a++ % b++ *a + b++* --b;
Give the output of the snippet:
int a=10,b=12; if(a==10&&b<=12) a--; else ++b; System.out.println(a + "and" +b);