Amazon banner

Sunday, 16 September 2012

PROGRAM TO PRINT A CALENDAR


/********************************************************/
/* PROGRAM TO PRINT A CALENDAR                          */
/* AUTHOR : DEEPAK MAHAKALE 3 YEAR IT SRCOEM            */
/* BLOG : www.mahakaledeepak.blogspot.com               */
/********************************************************/

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>

void main() {

  int i, j, f_d, t_d, dt = 1;
  clrscr();
  printf("\n\t PROGRAM TO PRINT A CALENDAR ");
  printf("\n\n\t Enter total no of days : ");
  scanf("%d", & t_d);
  printf("\n\t Enter first day <0-Mon..5-Sat,6-Sun> : ");
  scanf("%d", & f_d);

  printf("\n\n\t M \t T \t W \t T \t F \t S \t S \n");
  printf("\t _________________________________________________\n");

  for (j = f_d; j > 0; j--) {
    printf("\t");
  }

  while (dt <= t_d) {
    if (f_d != 0) {
      if (f_d % 7 == 0)
        printf("\n");
    }
    printf("\t %d", dt);
    dt++;
    f_d++;
  }

  printf("\n\n\n\t BY - DEEPAK MAHAKALE");
  getch();

}

No comments:

Post a Comment