हिंदी

Rewrite the following using ternary operator. if (x % 2 == 0) System.out.println("Even"); else discount = bill * 5.0 / 100; - Computer Applications

Advertisements
Advertisements

प्रश्न

Rewrite the following using ternary operator.

if (x % 2 == 0) 
System.out.println("Even");
else
discount = bill * 5.0 / 100;
एक पंक्ति में उत्तर

उत्तर

String s = (x % 2 == 0) ? "Even" : "Odd";
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 1.04: Operators in Java - EXERCISES [पृष्ठ ४४]

APPEARS IN

अविचल Computer Applications [English] Class 10 ICSE
अध्याय 1.04 Operators in Java
EXERCISES | Q V. 8. (a) | पृष्ठ ४४
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×