Output Questions for Class 10 ICSE Computer Applications

Rewrite the following program segment using if-else statements instead of the ternary operator:

net = (salary > 10000) ? salary - (8.33/100)*salary : salary - (5/100)*salary

Java

Java Operators

62 Likes

Answer

if (salary > 10000)
    net = salary - (8.33/100) * salary;
else
    net = salary - (5/100) * salary;

Answered By

39 Likes