1.

Rewrite the following code using switch statement :if (code == 'A')allowance = 3500;else if (code == 'B')allowance = 3200;elseallowance = 2000;

Answer»

switch(code)

{

case ‘A’ : allowance = 3500;

break ;

case ‘B’ : allowance = 3200;

break ;

default : allowance = 2000;

}

Note: 65 in place of ‘A’ and 66 in place of ‘B’ should be accepted



Discussion

No Comment Found

Related InterviewSolutions