MAKING A CALENDER FOR GIVEN YEAR.
 #include<stdio.h>
 void day(int,int,int);
 char days[7][10]={"saturday","sunday","monday","tuesday","wednessday",
          "thursday","friday"};
 int mon[12]={31,28,31,30,31,30,31,31,30,31,30,31};
 void main()
 {
  char month[12][15]={"January","Febrauary","March","April","May","June",
  "July","August","September","October","November","December"};
  static int d,m,tdays,i,t1,t2,y,count=0,prnt=0;
  clrscr();
  printf("		    THE DAY OF GIVEN DATE, MONTH & YEAR
");
");
  printf("			CALENDER FOR THE GIVEN YEAR
");
");
  printf("
Enter the date, month & year:
");
Enter the date, month & year:
");
  scanf("%d%d%d",&d,&m,&y);
  day(d,m,y);
  printf("
Press any key for printing the %d calender.
",y);
Press any key for printing the %d calender.
",y);
  getch();
  for(m=1;m<=12;m++)
  {
   if(y%4==0) mon[1]=29;
   for(i=0;i<m-1;i++) t1+=mon[i];
   tdays=(365*(y-1)+t1+(y/4)+1);
   t2=tdays%7;
   clrscr();
   printf("
%s %d
",month[m-1],y);
%s %d
",month[m-1],y);
   printf("
sun mon tue wed thu fri sat
");
sun mon tue wed thu fri sat
");
   if (t2==0) t2=7;
   for(i=1;i<t2;i++)
   {
    printf("        ");
    count++;
   }
   while(prnt<mon[m-1])
   {
    if (count==7)
    {
     printf("
");
");
     count=0;
    }
    printf("%8d",++prnt);
    count++;
   }
   getch();
   t1=0;
   count=0;
   prnt=0;
  }
 }
 void day(int d,int m,int y)
 {
  static int t1,tdays,i,t2;
  if(y%4==0) mon[1]=29;
  for(i=0;i<m-1;i++) t1+=mon[i];
  tdays=(365*(y-1)+t1+(y/4)+d);
  t2=tdays%7;
  printf("
The given day is... %s",days[t2]);
The given day is... %s",days[t2]);
 }