Print Name of Day using Switch Case
Here, you will get the program code to print name of day using switch case in c programming.
This is a simple switch case example program, In which we will get a number input(1 to 7) from user and print the day name as output. for example:
1 is Monday
2 is Tuesday
3 is Wednesday etc….
Program to Print Name of Day
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include<stdio.h> int main() { int day,b,c; clrscr(); printf("\nEnter Number of day( 1-7) to Print day name : "); scanf("%d",&day); switch(day) { case 1: printf("\n Monday"); break; case 2: printf("\n Tuesday"); break; case 3: printf("\n Wednesday"); break; case 4: printf("\n Thursday"); break; case 5: printf("\n Friday"); break; case 6: printf("\n Saturday"); break; case 7: printf("\n Sunday"); break; default: printf("You have entered Wrong Input"); } getch(); } |
Output
Check our other C programming Examples