b.
Rewrite the following using ternary operator:-
if(b > 100)
d = b + 20;
else
d=b*5
Answers
Answered by
0
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.
Similar questions