Hi,
I'm tasked with creating a program that displays the date of Easter Sunday, and this is what I have been able to do far:
Code:
#include <stdio.h>
int year, c, d, e, a, b, result, day, month;
int main() {
year = 2013;
c = year % 19;
d = year % 4;
e = year % 7;
a = (19 * c + 24) % 30;
b = (2 * d + 4 * e + 6 * a + 5) % 7;
result = 22 + a + b;
day = result % 30 + ?; // ???
month = 3 + ?; // ???
printf("Easter Sunday in year %d is day %d of month %d\n", year, day, month);
}
What I'm stuck on is displaying the day and month correctly. Apparently we have to add a "magic quantity".