According to the Gregorian calendar it was monday on the date 01/01/01. if any year is input through the keyboard write a program to find out what is the day on 1st January of this year?

Was that 01/01/2001 or 01/01/0001 ?

Hello avinash7,
We won't do your homework for you. However, we can get you on the right track if you'll be so kind as to share your written code with us.

If you look at the calendar you will notice that Jan 1 falls on a different day of the week each year. So if 1 Jan 2001 was a Monday, then 1 Jan 2002 will be Tuesday, 1 Jan 2003 is Wednesday, etc. On leap year a day is skipped, so 1 Jan 2004 was Friday, not Thursday. Your program should find out the number of years between 2001 and the inputed year then figure out the day of the week.

As a huge hint, here is a macro that calculates the number of leap years for a given year:

#define LEAP_COUNT(year) ((((year) - 1) / 4) - (((year) - 1) / 100) + (((year) - 1) / 400))