-
Notifications
You must be signed in to change notification settings - Fork 0
/
strucct_date.c
63 lines (59 loc) · 1.26 KB
/
strucct_date.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
57
58
59
60
61
62
63
#include <stdio.h>
struct date {
int days;
int month;
int year;
} asked;
void display(struct date asked);
int main(){
printf("Enter date: \n");
printf("(In integer form)\n");
printf("Enter month : ");
scanf("%d",&asked.month);
printf("Enter day : ");
scanf("%d",&asked.days);
printf("Enter year : ");
scanf("%d",&asked.year);
display(asked);
}
void display(struct date asked){
switch(asked.month){
case 1:
printf("January");
break;
case 2:
printf("February");
break;
case 3:
printf("March");
break;
case 4:
printf("April");
break;
case 5:
printf("May");
break;
case 6:
printf("June");
break;
case 7:
printf("July");
break;
case 8:
printf("August");
break;
case 9:
printf("September");
break;
case 10:
printf("October");
break;
case 11:
printf("November");
break;
case 12:
printf("December");
break;
}
printf(" %d, %d",asked.days%32,asked.year);
}