According to the Gregorian Calendar, it was monday on the date 01/01/1900. If any year is input through the keyboard write the program to find out what is the day on 1st January of the entered year.
// day of the week for january 1st
#include <iostream>
usingnamespace std;
int main ()
{
char*week[]={"sun","mon","tue","wed","thu","fri","sat"};
int year,days;
cout<< "year?"; cin>>year;
days = 365*year + (year-1)/4 - (year-1)/100 + (year-1)/400 ;
cout<<week[days%7]<<"\n";
return 0;
}