Monthly Calendar by smkt

main(y,m,w,r,z,c,d){char *N[]={"\x1fJan","\0Feb","\x1fMar","\x1eApr","\x1fMay","\x1eJun","\x1fJul","\x1fAug","\x1eSep","\x1fOct","\x1eNov","\x1fDec"};
while(scanf("%d %d",&y,&m)>1){m--;printf("%s %d\n",N[m]+1,y);r=N[m][0]?N[m][0]:y%4==0&y%100!=0|y%400==0?29:28;d=1;m++;w=(d+=m<3?y--:y-2,23*m/9+d+4+y/4-y/100+y/400)%7;
c=w;while(w--)printf("   ");for(z=1;z<r+1;z++)printf(" %2d",z),++c>6?c=0,puts(""):0;printf("%s\n",c?"\n":"");}}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page