Computer Applications
Rewrite the snippet using Ternary operators:
if(a<b)
{
c=(a+b);
}
else {
c=(a-b);
}
Java Operators
67 Likes
Answer
c = a < b ? (a + b) : (a - b);
Answered By
36 Likes
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