Rewrite the following using ternary operator:
if (bill>10000)
discount=bill*10.0/100;
else
discount=bill*5.0/100;
Answers
Answered by
0
Answer:
Given snippet:-
if (bill>10000)
discount=bill*10.0/100;
else
discount=bill*5.0/100;
Using ternary operator:-
discount=(bill>10000)?(bill*10.0/100):(bill*5.0/100.0);
Similar questions
Math,
17 days ago
Math,
17 days ago
Math,
1 month ago
Computer Science,
8 months ago
English,
8 months ago