KnowledgeBoat Logo

Output Questions for Class 10 ICSE Computer Applications

Rewrite the following using ternary operator:

if (p >= 4750)
    k = p * 5 / 100;
else
    k = p * 10 / 100;

Java

Java Operators

ICSE

63 Likes

Answer

k = (p >= 4750) ? p * 5 / 100 : p * 10 / 100;

Answered By

38 Likes