-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path09-dayofweek-switch-case.c
51 lines (44 loc) · 946 Bytes
/
09-dayofweek-switch-case.c
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* C program to print day of week using SWITCH-CASE
*/
#include <stdio.h>
int main()
{
int week;
/* Input week number from user */
printf("Enter week number(1-7): ");
scanf("%d", &week);
// if (week == 1){
// }
// else if(week==2){
// }
// ip : week = 4
switch(week)
{
case 1:
printf("Sunday");
break;
case 2:
printf("Monday");
break;
case 3:
printf("Tuesday");
break;
case 4:
printf("Wednesday");
break;
case 5:
printf("Thursday");
break;
case 6:
printf("Friday");
break;
case 7:
printf("Saturday");
break;
default:
printf("Invalid input! Please enter week number between 1-7.");
}
printf("\nEnd of program");
return 0;
}