-
Notifications
You must be signed in to change notification settings - Fork 0
/
year_2020_calender.c
80 lines (76 loc) · 1.4 KB
/
year_2020_calender.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <stdio.h>
#include <math.h>
#define pi 3.14f
void month(int space,int day){
int ret=0;
for(int i=0;i<space;i++){
printf(" ");
ret++;
}
for(int i=1;i<=day;i++){
if(ret>=7){
printf("\n");
ret=0;
}
printf("%3d ",i);
ret++;
}
}
int main(){
int input ;
scanf("%d",&input);
printf("Sun Mon Tue Wed Thu Fri Sat \n");
int space=0,day=0;
switch(input){
case 1:
space=3;
day=31;
break;
case 2:
space=6;
day=29;
break;
case 3:
space =0;
day=31;
break;
case 4:
space=3;
day=30;
break;
case 5:
space=5;
day=31;
break;
case 6:
space=1;
day=30;
break;
case 7:
space=3;
day=31;
break;
case 8:
space=6;
day=31;
break;
case 9:
space=2;
day=30;
break;
case 10:
space=4;
day=31;
break;
case 11:
space=0;
day=30;
break;
case 12:
space=2;
day=31;
break;
}
month(space,day);
return 0;
}