C LANGUAGE - FINDING A DAY USING SWITCH CASE

// Find day using switch case #include<stdio.h> #include<conio.h> void main() { int day; clrscr(); printf("Enter day number:>>\n"); scanf("%d",&day); switch(day) { case 1: { printf("Monday"); break; } case 2: { printf("Tuesday"); break; } case 3: { printf("Wednesday"); break; } case 4: { printf("Thursday"); break; } case 5: { printf("Friday"); break; } case 6: { printf("Saturday"); break; } case 7: { printf("Sunday"); break; } default: { printf("Invalid day number"); } printf("\nHave a nice day"); } getch(); }
Note: Click on copy button to copy the given code and you can paste it in any online compiler to see the result, IF YOU ARE A MOBILE USER THEN DOWNLOAD "CODING C"(Free App) COMPILER FROM GOOGLE PLAY STORE.