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 [पृष्ठ ४४]
