Input: 12-18-2009 Ouput: It is a friday!
Write a program that takes a date as input and prints out the day of the week corresponding to the date.
For example:
Input: 12-18-2009 Ouput: It is a friday!
The input is in the following format: mm-dd-yyyy
The date could either be in the past or in the future.
Modularize your code by writing 3 or more functions.
Finally test your code with your birth date and check if you get the right answer!
Hints:
Do not ignore leap years. A check for leap year is as follows:
if (year%400 == 0 || (year%100 != 0 && year%4 == 0)) { printf("Year %d is a leap year", year); }
You may want to hard code today's date and day in the code, and then compute the offset of the user input with respect to the hard coded date.
Use modulo 7 to avoid integer overflows