我刚写了个,不过我人比较懒拉,你看看吧
#include<stdio.h>
void main(void)
{ int b[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int year,month,know=1950;
int i,j,k,l,m,n;
printf("input the year between 1950 to 2050:");
scanf("%d",&year);
k=year-know;
l=k%4;
m=k/4;
if(l==0) l=(5*m)%7;
else if (l==1) l=(1+5*m)%7;
else if(l==2) l=(2+5*m)%7;
else l=(4+5*m)%7;
if(l==2) b[2]=29;
for(month=1;month<=12;month++)
{ switch(month)
{ case 1: printf("====Jan====\n"); break;
case 2: printf("====Feb====\n"); break;
case 3: printf("====Mac====\n"); break;
case 4: printf("====Apl====\n"); break;
case 5: printf("====May====\n"); break;
case 6: printf("====Jun====\n"); break;
case 7: printf("====July====\n"); break;
case 8: printf("====Aug====\n"); break;
case 9: printf("====Sep====\n"); break;
case 10: printf("====Oct====\n"); break;
case 11: printf("====Nov====\n"); break;
case 12: printf("====Dec====\n"); break;
}
printf("Sun Mon Tue Wen Tur Fri Sat \n");
if(month!=1) l=(b[month-1]+l)%7;
else l=l;
for(j=0;j<l;j++)
{ putchar(' ');
putchar(' ');
putchar(' ');
}
n=1;
for(i=l;i<b[month]+l;i++)
{ printf("%3d",n);
n++;
if(i%7==6) printf("\n");
}
printf("\n");
if(month==1) getchar();
getchar();
}
}