First day of the Year

Write a program that takes the year as input and tell the first day of that year.

#include


#include



int main ()

{



int year,days,d;

printf("year?"); scanf("%d",&year);

days = 365*year + (year-1)/4 - (year-1)/100 + (year-1)/400 ;





d=days%7;//to find which day of week





if(d==1)

printf("\n\n\tmonday");

else if(d==2)

printf("\n\n\ttuesday");

else if(d==3)

printf("\n\n\twednesday");

else if(d==4)

printf("\n\n\tthursday");

else if(d==5)

printf("\n\n\tfriday");

else if(d==6)

printf("\n\n\tsaturday");

else if(d==0)

printf("\n\n\tsunday");

getch();

return(0);

}

Comments

Popular posts from this blog

Tip of the Day # 13

Governor Generals of Pakistan

Tip of the Day# 12