Question
C Programming Write a function that takes a date and prints out what day it is. The formula for finding the day of the week
C Programming
Write a function that takes a date and prints out what day it is. The formula for finding the day of the week by entering the given year, month, and day is:
(year + year/4 - year/100 + year/400 + (13 * month + 8) / 5 + day) % 7
This result (0 ~ 6) and Sunday, Monday, ... , Saturday, and write the program. Enum can be used as one integer variable. For example, it can be used for switch, comparison, and for and while condition. The prototype of the function is as follows. enum Date getDate (int y, int m, int d); // return the value corresponding to the day of the week char * getDay (enum Date currDate); // return the string of the day corresponding to currDate Implement the following structure to store the data for this program. (where date is an enum variable representing the value from Sunday through Saturday)
struct Calendar{
int year, month, day;
enum Date date; // getDate function
char* dateString; // getDay function
};
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started