What is wrong in the following code?Explain. (3)
switch (p)
?
case 3: x=12;
y=35;
z=x*y;
break;
case 3: a=20;
b=76;
break;
z=x*y;
}
Answers
Answered by
3
Answer:
The corrected code
switch(p)
{
case 1:
x=12,y=35;
z=x*y;
break;
case 2:
a=20,b=76;
z=a*b;
break;
default:
System.out.println("Invalid choice");
}
The bolded statement is optional
Similar questions