#include<stdio.h>
void main()
{
int
d,dd,mm,y,i,j,count=0,k=1,m;
printf("enter
date");
scanf("%d",&d);
printf("enter
month");
scanf("%d",&mm);
printf("enter
year");
scanf("%d",&y);
dd=1;
if(mm == 4 || mm
== 6||mm == 9||mm == 11)
m=30;
else if(mm == 2)
{
if(y%4 == 0)
m=29;
else
m=28;
}
else
m=31;
if(y==2000&&mm<=2)
dd=dd-1;
count=count+(dd%7);
if(mm==1)
count=count+0;
else if(mm==2)
count=count+3;
else if(mm==3)
count=count+3;
else if(mm==4)
count=count+6;
else if(mm==5)
count=count+1;
else if(mm==6)
count=count+4;
else if(mm==7)
count=count+6;
else if(mm==8)
count=count+2;
else if(mm==9)
count=count+5;
else if(mm==10)
count=count+0;
else if(mm==11)
count=count+3;
else if(mm==12)
count=count+5;
else
printf("wrong entry");
i=y%100;
count=count+(i/4)+(i%7);
if(y>=1800&&y<=1899)
count=count+2;
else
if(y>=1900&&y<=1999)
count=count+0;
else
if(y>=2000&&y<=2099)
count=count+6;
else
if(y>=2100&&y<=2199)
count=count+4;
else
printf("enter year between
1800 to 2199 only");
j=count%7;
printf("sun
mon tue wed thu fri sat \n");
printf("\n");
for(i=0;i<m+j;i++)
{
if(i<j)
printf(" ");
else
{
if(i%7
== 0)
printf("\n");
if(i
== d+j-1)
{
if(k<10)
printf(" *%d ",k++);
else
printf("*%d ",k++);
}
else
{
if(k<10)
printf("
%d ",k++);
else
printf(" %d ",k++);
}
}
}
}
No comments:
Post a Comment