I am doing a project that has the user input any year ranging from 1900 to 2099 and it will display what year easter sunday was on. The equation I have works for every year except 1954, 1981, 2049, 2076. Now my code works for every other year excpet these. I always get the day for these years to come up seven days ahead of what it should. Could someone look at my code and see if they can find a problem.
#include <iostream>
#include <math.h>
#include <iomanip.h>
int main()
{
int year;
cout << "Easter Sunday Calculator" << endl;
cout << "Enter the year: ";
cin >> year;
int a = year % 19;
int b = year % 4;
int c = year % 7;
int d = ( 19 % ( a + 24 ) ) % 30;
int e = ( 2 * ( b + 4 ) * ( c + 6 ) * ( d + 5 ) ) % 7;
int day = 22 + d + e;
if ( ( day <= 31 ) && ( year != 1954, 1981, 2049, 2076 ) )
{
cout << "March " << day << endl;
}
else if ( ( day > 31 ) && ( year != 1954, 1981, 2049, 2076 ) )
{
day = day - 31;
cout << "April " << day << endl;
}
else
{
day = day - 38;
cout << "April " << day << endl;
}
return 0;
}