#include<stdio.h>
#include<conio.h>
int month(int,int);
void main()
{
int
yy,a,a1,a2,b,b1,b2,i,sm=0,c,d,e;
clrscr();
scanf("%d",&yy);
yy=yy-1;
a=yy%400;
b=yy/400;
a1=a%100;
b1=a/100;
a2=a1/4;
b2=a1-a2;
sm=b*0+b1*5+a2*2+b2*1+1;
sm=sm%7;
printf("\n\n\n\nJanuary\n\n");
sm=month(31,sm);
printf("\n\n\n\nFebruary\n\n");
if((yy+1)%4==0)
sm=month(29,sm);
else
sm=month(28,sm);
printf("\n\n\n\nMarch\n\n");
sm=month(31,sm);
printf("\n\n\n\nApril\n\n");
sm=month(30,sm);
printf("\n\n\n\nMay\n\n");
sm=month(31,sm);
printf("\n\n\n\nJune\n\n");
sm=month(30,sm);
printf("\n\n\n\nJuly\n\n");
sm=month(31,sm);
printf("\n\n\n\nAugust\n\n");
sm=month(31,sm);
printf("\n\n\n\nSeptember\n\n");
sm=month(30,sm);
printf("\n\n\n\nOctober\n\n");
sm=month(31,sm);
printf("\n\n\n\nNovember\n\n");
sm=month(30,sm);
printf("\n\n\n\nDecember\n\n");
sm=month(31,sm);
getch();
}
int month(int c,int d)
{
int i,j,k;
printf(" Sun
Mon Tue Wed
Thu Fri Sat\n\n");
for(i=0;i<=d;i++)
if(i>=d)
{
for(j=1;j<=c;j++)
{
if(i%7==0)
printf("\n");
printf("%6d",j);
i++;
}
}
else
printf(" ");
k=(c+d)%7;
return(k);
}
OUTPUT:
Enter
which year you want show the calander-2012
January
Sun Mon Tue Wed Thu Fri Sat
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
|
February
Sun Mon Tue Wed Thu Fri Sat
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
|
March
Sun Mon Tue Wed Thu Fri Sat
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
|
April
Sun Mon Tue Wed Thu Fri Sat
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
|
May
Sun Mon Tue Wed Thu Fri Sat
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
|
June
Sun Mon Tue Wed Thu Fri Sat
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
|
July
Sun Mon Tue Wed Thu Fri Sat
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
|
August
Sun Mon Tue Wed Thu Fri Sat
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
|
September
Sun Mon Tue Wed Thu Fri Sat
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
|
October
Sun Mon Tue Wed Thu Fri Sat
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
|
November
Sun Mon Tue Wed Thu Fri Sat
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
|
December
Sun Mon Tue Wed Thu Fri Sat
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
|
No comments:
Post a Comment