/*
* 1000+ C programs + tutorials
*
*
* 43_Display_day_of_week_switch_case_C_program.c
*
*
* Created on: Oct 20, 2014
* Author: Code2care.org
*/
#include
//#include
void main() {
int day;
//clrscr();
printf("C Program Displays Day of Week for entered number");
printf("\n\n Enter Day (1-7) : ");
scanf("%i", &day);
switch(day) {
case 1:
printf("\n\n The 1st day of week is : Sunday");
break;
case 2:
printf("\n\n The 2nd day of week is : Monday");
break;
case 3:
printf("\n\n The 3rd day of week is : Tuesday");
break;
case 4:
printf("\n\n The 4th day of week is : Wednesday");
break;
case 5:
printf("\n\n The 5th day of week is : Thursday");
break;
case 6:
printf("\n\n The 6th day of week is : Friday");
break;
case 7:
printf("\n\n The 7th day of week is : Saturday");
break;
default:
printf("Invalid input!!! ..... ");
}
//getch();
}
-
Output :
C Program Displays Day of Week for entered number
Enter Day (1-7) : 4
The 4th day of week is : Wednesday
C Program Displays Day of Week for entered number
Enter Day (1-7) : 2
The 2nd day of week is : Monday
C Program Displays Day of Week for entered number
Enter Day (1-7) : 9
Invalid input!!! .....
The best way to learn C programming is to practice more and more of programs .
Code2care C Programming tutorials provide 1000+ programs in C that you can study and become an expert in the language. Programs are divided into categories depending upon type and complexity.
BSc. IT, BSc. Computer Science, BSc. IT, MSc. IT, MSc. Computer Science, MCA, BTech IT & BTech Engineers may find these programs very useful.