C programme to print the calendar of given Month
Source Code:
#include<stdio.h> #include<conio.h> int main() { int day,i=1,c=0,j; printf("\nEnter the starting day of the month(1-Monday)"); scanf("%d",&day); printf("\n\nSun\tMon\tTue\tWed\tThur\tFri\tSat\n"); printf("\n===========================================================\n"); printf("\n"); if(day==1) { c=1; } else if (day == 2) { c=2; printf("\t"); } else if (day == 3) { c=3; printf("\t\t"); } else if (day == 4) { c=4; printf("\t\t\t"); } else if (day == 5) { c=5; printf("\t\t\t\t"); } else if (day == 6) { c=6; printf("\t\t\t\t\t"); } else if(day==7) { c=7; printf("\t\t\t\t\t\t"); } while(i<=30) { printf("%d\t",i); i++; if(c%7==0) { printf("\n"); } c++; } }
0 comments:
Post a Comment