Solution :
#include<
>
int
(int d,
, int y){
static
= { 0,
, 5,
, 5, 1,
};
y -=
;
return (
y/4 - y/100 + y/400 + t[m-1] + d) % 7;
}
int main() {
int month,year,i;
printf("Enter Month : ");
scanf("%d",&month);
printf("Enter Year : ");
scanf("%d",&year);
//find week day number
int day = dayofweek(1,month,year);
char * weekDays[] = {"Su","Mo","Tu","We","Th","Fr","Sa"};
printf("\\");
//print week day header
for(i=0;i<7;i++)
printf("%s ",weekDays[i]);
printf("\\");
//print days accordingly
for(i=0;i<day;i++)
printf(" ");
for(i=day;i<=day+30;i++){
printf("%-2d ",i-day+1);
if((i+day)%7==0)
printf("\\");
}
}