KnowledgeBoat Logo

Output Questions for Class 10 ICSE Computer Applications

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;

Java

Java Operators

ICSE

167 Likes

Answer

g = a > b ? a > c ? a : c : b > c ? b : c;

Answered By

95 Likes