Rewrite following using switch case: [2]
if( x == 1)
System.out.println("Excellent");
else if( x == 2)
System.out.println("Good");
else if( x ==3 )
System.out.println("fair");
else
System.out.println("poor");
Answers
Answered by
0
Answer:
switch (x)
{
case 1 : System.out.println ("Excellent") ;
break;
case 2: System.out.println ("Good") ;
break;
case 3:System.out.println ("fair") ;
break;
default:System.out.println ("poor") ;
}
Explanation:
Similar questions