char ch;
ch = ‘c’;
switch (ch)
{
case ‘a’:
printf(“Good Morning!”); break;
case ‘b’:
printf(“Have a Nice Day!”); break;
case ‘c’:
case ‘d’:
case ‘e’:
printf(“Good Bye!”); break;
}
Output: The value of ch
is 'c'
, so the program will match case 'c'
, but because there is no break
statement immediately after it, the control will fall through to the next cases (without checking the condition). It will execute the code associated with case 'c'
, case 'd'
, and case 'e'
, printing “Good Bye!”. The output will be: