Computer Applications
Rewrite the snippet using Ternary operators:
if(a<b)
{
c=(a+b);
}
else {
c=(a-b);
}
Java Operators
69 Likes
Answer
c = a < b ? (a + b) : (a - b);
Answered By
37 Likes
Rewrite the snippet using Ternary operators:
if(a<b)
{
c=(a+b);
}
else {
c=(a-b);
}
69 Likes
c = a < b ? (a + b) : (a - b);
Answered By
37 Likes