-
Notifications
You must be signed in to change notification settings - Fork 0
/
nestedif1.c
56 lines (54 loc) · 1.09 KB
/
nestedif1.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
52
53
54
55
56
// Write a programe to print days for user given number
// 1 - > Monday
// 2 - > Tuesday
// 3 - > Wednesday
// 4 - > Thursday
// 5 - > Friday
// 6 - > Saturday
// 7 - > Sunday
#include <stdio.h>
void main()
{
int number;
printf("Enter value of number ");
scanf("%d", &number);
if (number > 0 && number < 8)
{
if (number == 1)
{
printf("Monday ");
}
else if (number == 2)
{
printf("Tuesday ");
}
else if (number == 3)
{
printf("Wednesday ");
}
else if (number == 4)
{
printf("Thursday ");
}
else if (number == 5)
{
printf("Friday ");
}
else if (number == 6)
{
printf("Saturday ");
}
else if (number == 7)
{
printf("Sunday ");
}
else
{
printf("Invalid number ");
}
}
else
{
printf("Invalid input ");
}
}