#C11132. Day of the Week Calculator
Day of the Week Calculator
Day of the Week Calculator
Given a date in the Gregorian calendar, your task is to determine the day of the week. The solution should use Zeller's Congruence algorithm, where the formula is given by:
\( h = \left(q + \left\lfloor\frac{13(m+1)}{5}\right\rfloor + K + \left\lfloor\frac{K}{4}\right\rfloor + \left\lfloor\frac{J}{4}\right\rfloor - 2J\right) \mod 7 \)
Here,\(q\) is the day, \(m\) is the month (with January and February treated as months 13 and 14 of the previous year), \(K\) is the year of the century, and \(J\) is the zero-based century. The value returned by the algorithm maps to the day of the week as follows: 0=Saturday, 1=Sunday, 2=Monday, 3=Tuesday, 4=Wednesday, 5=Thursday, 6=Friday.
Your program will receive three integers representing the day, month, and year. It should then output the corresponding day name.
inputFormat
The input consists of three space-separated integers:
- day: An integer representing the day.
- month: An integer representing the month.
- year: An integer representing the year.
All input is provided via stdin.
outputFormat
Output the name of the day for the given date as a single string on stdout.
## sample3 8 2023
Thursday