Computer Applications
Rewrite the following using ternary operator.
if(n1 > n2)
r = true;
else
r = false;
Java Operators
9 Likes
Answer
r = n1 > n2 ? true : false;
Answered By
3 Likes
Related Questions
Rewrite the following using ternary operator:
if (bill > 10000) discount=bill*10.0/100; else discount=bill*5.0/100;Rewrite the following using ternary operator:
if(income < 10000) tax = 0; else tax = 12;Rewrite the following using ternary operator:
if(a > b) { if (a > c) g = a; else g = c; } else if (b > c) g = b; else g = c;Rewrite the following using ternary operator:
if (p >= 4750) k = p * 5 / 100; else k = p * 10 / 100;