English

Rewrite the following using ternary operator. if (income < 10000) tax = 0; else tax = 12; - Computer Applications

Advertisements
Advertisements

Question

Rewrite the following using ternary operator.

if (income < 10000)
tax = 0; 
else
tax = 12; 
One Line Answer
Advertisements

Solution

int tax = (income < 10000) ? 0 : 12
shaalaa.com
  Is there an error in this question or solution?
Chapter 1.04: Operators in Java - EXERCISES [Page 44]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 1.04 Operators in Java
EXERCISES | Q V. 8. (c) | Page 44
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×