Computer Science, asked by Podilapu1362, 8 months ago

Change this if else into ternary operators?
if (tax>100) tax=tax*0.1;
else tax=tax*0.2;

Answers

Answered by DennisRitchie
0

Quite Simple

(tax>100?tax=tax*0.1:tax=tax=tax*0.2);

If the condition is true the tax contains tax=tax*0.1 else tax contains tax*0.2

Similar questions