Computer Science, asked by 1236746, 6 months ago

Rewrite the following using ternary operator:

if (bill >10000 )

discount = bill * 10.0/100;

else

discount = bill * 5.0/100;

Answers

Answered by sutapadey053
26

Answer:

discount =(bill>10000)?bill*10.0/100:bill*5.0/100;

Explanation:

when rewriting an if else snippet into ternary operator,the syntax is :

variable in which the result is to be stored=(condition) v value if the condition is true : value if the condition is false

hope it helps.

Answered by suchitavarma626
0

Answer:

thank u for your answer nice answer

Similar questions