#include
void main()
{
FILE *fpin,*fpout;
int a,i,j,m=0,mon,l,k;
fpin=freopen("c:\\TC\\work\\a.in","r",stdin);
fpout=freopen("c:\\TC\\work\\a.out","w",stdout);
while(scanf("%d",&a)==1)
{
for(i=1;i<=a;i++)
{
if(i==a)
printf("\n YEAR %d ",i);
for(j=1;j<=12;j++)
{
if(i%4==0&&j==2)
mon=29;
else if(j==2)
mon=28;
else if(j==1||j==3||j==5||j==7||j==8||j==10||j==12)
mon=31;
else
mon=30;
if(j==1&&i==a)
printf("\n\n JANUARY ");
else if(j==2&&i==a)
printf("\n\n FEBRUARY ");
else if(j==3&&i==a)
printf("\n\n MARCH ");
else if(j==4&&i==a)
printf("\n\n APRIL ");
else if(j==5&&i==a)
printf("\n\n MAY ");
else if(j==6&&i==a)
printf("\n\n JUNE ");
else if(j==7&&i==a)
printf("\n\n JULAY ");
else if(j==8&&i==a)
printf("\n\n AUGUST ");
else if(j==9&&i==a)
printf("\n\n SEPTEMBER ");
else if(j==10&&i==a)
printf("\n\n OCTOBER ");
else if(j==11&&i==a)
printf("\n\n NOVEMBER ");
else if(j==12&&i==a)
printf("\n\n DECEMBER ");
if(i==a)
{
printf("\n SUN MON TUE WED THU FRI SAT\n");
printf(" ");
}
for(l=1;l<=m;l++)
{
if(i==a)
printf(" ");
}
for(k=1;k<=mon;k++)
{
if(i==a)
{
printf("%2d ",k);
}
m++;
if(m==7)
{
if(i==a)
{
printf("\n");
printf(" ");
}
m=0;
}
}
// printf("\n");
}
// printf("\n%d",a*3);
}
}
}
0 comments:
Post a Comment