Sail E0 Webinar
Question

We want to test whether a value lies in the range 2 to 4 or 5 to 7. Can we do this using a switch?


Options:
A .  Yes
B .  No
Answer: Option A


We can do this in following switchstat ement


switch(a)
{
case 2:
case 3:
case 4:
/* some statements */
break;
case 5:
case 6:
case 7:
/* some statements */
break;
}



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers