Rewrite the following using ternary operator : if (bill > 10000) discount = bill * 10.0 / 100; else discount = bill * 5.0 / 100;
Advertisements
प्रश्न
Rewrite the following using ternary operator :
if (bill > 10000)
discount = bill * 10.0 / 100;
else
discount = bill * 5.0 / 100;एका वाक्यात उत्तर
Advertisements
उत्तर
double discount = (bill > 1000) ? bill * 10.0 / 100 : bill * 5.0 / 100;shaalaa.com
Introduction of Operators in Java
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 1.04: Operators in Java - EXERCISES [पृष्ठ ४४]
