Year Calculation

Description:

As per the Calendar, the new year of the new millennium (Jan1st 2000) began on a saturday. Taking any year as input , write a program to display which day of the week shall the new year fall on . Input Input an Integer year Y such that 1800

Program :

#include <stdio.h>

#include <string.h>

int main()

{

long int nd,ld,td,fd,year;

scanf("%ld",&year);

nd=(year-1)*365;

ld=(year-1)/4-(year-1)/100+(year-1)/400;

td=nd+ld;

fd=td%7;


if(fd==0)

printf("\n monday");

if(fd==1)

printf("\n tuesday");

if(fd==2)

printf("\n wednesday");

if(fd==3)

printf("\n thursday");

if(fd==4)

printf("\n friday");

if(fd==5)

printf("\n saturday");

if(fd==6)

printf("\n sunday");

return 0;

}