#include<stdio.h>
#include<conio.h>
void cal(int yr,int mo,int fd,int da);
static char*months[]={
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"october",
"November",
"December"
};
void main()
{
clrscr();
static int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
long int ndays,ldays,tydays,tdays;
int d,i,m,fday,y;
char ch;
printf("Enter Year and Month Eg. 2000 01\n");
scanf("%d %d",&y,&m);
ndays=(y-1)*365;
ldays=(y-1)/4-(y-1)/100+(y-1)/400;
tdays=ndays+ldays+1;
if((y%100==0&&y%400==0)||(y%4==0&&y%100!=0))
days[1]=29;
else
days[1]=28;
d=days[m-1];
tydays=0;
for(i=0;i<=m-2;i++)
tydays=tydays+days[i];
tdays=tydays+tdays;
fday=tdays%7;
cal(y,m,fday,d);
}
void cal(int yr,int mo,int fd,int da)
{int i,r,c;
char a;
clrscr();
gotoxy(25,2);
textcolor(RED);
cprintf("%s %d",months[mo-1],yr);
gotoxy(5,5);
printf("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n ! \n\n !\n !\n !\n !\n !\n !\n !\n !");
gotoxy(10,6);
textcolor(GREEN);
cprintf("Mon Tue Wed Thu Fri Sat Sun !");
gotoxy(5,7);
printf("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\t\t\t\t\t\t !\n\n\t\t\t\t\t\t !\n\n\t\t\t\t\t\t !\n\n\t\t\t\t\t\t !\n\n\t\t\t\t\t\t");
r=9;
c=11+6*fd;
for(i=1;i<=da;i++)
{gotoxy(c,r);
textcolor(WHITE);
cprintf("%d",i);
if(c<=41)
c=c+6;
else
{c=11;
r=r+1;
}
}
gotoxy(5,15);
textcolor(YELLOW);
cprintf("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
getch();
}
No comments:
Post a Comment