# c programming help have the user enter a date ask separately for the day month and y 5150131

C programming help

1. Have the user enter a date (ask separately for the day, month and year). In the following example let us assume that the user entered the date October 11, 1996 (note that the user should enter the date in numerical format).
2. The user-defined function for option 1 should take this date as an input and output the day of the week in the following format: 0 for Sunday, 1 for Monday, 2 for Tuesday etc.
3. Use a reference date of which you know the weekday, e.g. June 1, 2019 is a Saturday.
4. Calculate the number of days between the reference date and the user entered date:
1. Iterate over the full years and count the days in the full years (take into account leap years (see leap year rules below)). In the example your program would iterate from 1997 to 2018 (inclusive) and add 365 days for each year or 366 if it is a leap year. So we would add 365 for all years except for 2000, 2004, 2008, 2012, 2016 where we would add 366. 17*365+5*366=8035 days.
2. Count the number of days in the months remaining in the year of the first date and in the year of the last date. In the example these are November and December for the first date and January, February, March, April, May before the second date. Hence add 30 + 31 = 61 days from the first date and 31+28+31+30+31= 151 days before the second date. Remember to account for leap years!
3. Count the number of days in the month of the first date and in the second date. Include the day of interest, but not the day of the reference date. In our example this is 21 days for the first date and 1-1 = 0 days for the second date.
4. Add all the numbers together to get the total number of days. Here: 8035+61+151+21 = 8268
5. Divide the number by 7 and determine the remainder. Here: 8268/7 is 1181 with a remainder of 1, so the weekday of the first date is 1 day before Saturday, i.e. Friday. Note that if the user&#39;s date is before the reference date as in the example here, the days indicated by the remainder tell you how many weekdays before the reference date the weekday of the user&#39;s date is. Otherwise it will give you the weekdays after the reference date.
6. Make sure to account for the possibility that the user enters a date after the reference date (in the example: June 1, 2019).

Leap year rules:

In the Gregorian calendar three criteria must be taken into account to identify leap years:

• The year can be evenly divided by 4;
• If the year can be evenly divided by 100, it is NOT a leap year, unless;
• The year is also evenly divisible by 400. Then it is a leap year.