"HARD WORK BEATS TALENT WHEN TALENT DOSEN'T WORK HARD."
"HARD WORK BEATS TALENT WHEN TALENT DOSEN'T WORK HARD."
Switch statements is used to create the multiple option. If there is multiple option in our program then we use switch statement.
switch(expression) { case 1: statement 1; break; case 2: statement 2; break; case n: statement n; default: statement 3; }
Switch statement first take expression then go for cases then match the case. If case not matched then move to next case, again not match go up to n(case), then go for default.
#include<stdio.h> #include<conio.h> void main() { int option; int n; clrscr(); printf("Enter Your Choice Between 1 to 3."); scanf("%d",&n); switch(option) { case 1: printf("Today is Monday."); break; case 2: printf("Today is Sunday."); break; case 3: printf("Today is Friday."); break; default: printf("You selected incorrect option."); } getch(); }