Question
(use programing language)Exercise 1: Day of the week Write a function that receives as input a date expressed as d (day) m (month) a (year),
(use programing language)Exercise 1: Day of the week Write a function that receives as input a date expressed as d (day) m (month) a (year), and returns the day of the week. For instance, if the date is 29/05/2014, the function must return Thursday. You will use the following formula: m1 = ( m ? 2 if m ? 3 m + 10 if m < 3 a1 = ( a if m ? 3 a ? 1 if m < 3 and with ns being the two first digits of a1 and as the two last digits of a1, we can compute f as f = d + as + as 4 ? 2ns + ns 4 + 26m1 ? 2 10 The day of the week will then be given by the modulo of f and 7[f%7] ( Sunday for 0, Monday for 1, Tuesday for 2, Wednesday for 3, Thursday for 4, Friday for 5, Saturday for 6). You must write a driver program to test your function.(USING C NOT C++)
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