Question: What is the mistake in the below switch statement? double a= 1.25; switch(a){ case 1.1: case 1.2: x= x*x; y= x; break; case 1.3: y=

What is the mistake in the below switch statement?

double a= 1.25;

switch(a){

case 1.1: case 1.2:

x= x*x; y= x; break;

case 1.3: y= x*x;

case 2.1: case 3.3:

y= sqrt(x); break;

case 3.5: printf(Error ); break;

default: y= x+1;

a) case 1.3 has no break

b) default doesnt have printf

c) a = 1.25 is not matched.

d) switch works only with integers

e) case 3.5 doesnt need break

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!