This C program uses a switch statement without break statements to demonstrate fall-through behavior. It takes an integer variable option with a value of 1, runs a switch on it, and prints "In case 1" followed by "In case 2" since there is no break after case 1. It then prints "In case default".
This C program uses a switch statement without break statements to demonstrate fall-through behavior. It takes an integer variable option with a value of 1, runs a switch on it, and prints "In case 1" followed by "In case 2" since there is no break after case 1. It then prints "In case default".
This C program uses a switch statement without break statements to demonstrate fall-through behavior. It takes an integer variable option with a value of 1, runs a switch on it, and prints "In case 1" followed by "In case 2" since there is no break after case 1. It then prints "In case default".
/*17. Write a program to demonstrate the use of switch statement without a break.
*/
#include <stdio.h> main() { int option = 1; switch(option) { case 1: printf("\n In case 1"); case 2: printf("\n In case 2"); default: printf("\n In case default"); } return 0; }