-
Notifications
You must be signed in to change notification settings - Fork 0
/
show-the-day.c
51 lines (38 loc) · 863 Bytes
/
show-the-day.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
/* Write a program that prompts the user to input a number. Program should display the corresponding days to the number.
For example if user type 1 the output should be sunday.
If user type 7 the output should be saturday. */
#include <stdio.h>
int main()
{
int day;
printf("Enter day number 1-7 :");
scanf("%d", &day);
/* Determine the corresponding week's day */
switch (day)
{
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");
}
return 0;
}