// Solution of Assignment 2.

#include <iostream>
#include <string>
using namespace std;
int main()
{
	int year, a, b, c, d, e, day;
	cout << "Enter the year in a four-digit format (for example, 2002).\n"
		<< "The year must be between 1982 and 2048.\n";
	cin >> year;
	// Check if the year is in the range
	if ((year >= 1982) && (year <= 2048))
	{
		a = year % 19;
		b = year % 4;
		c = year % 7;
		d = (19 * a + 24) % 30;
		e = (2 * b + 4 * c + 6 * d + 5) % 7;
		day = 22 + d + e;
		cout << "\n\t";
		// If day > 31 change month to April and correct day.
		if (day > 31)
		{
			day = day % 31;
			cout << "Easter is Sunday, " << "April " 
				<< day << ", " << year << "." << "\n\n";
		}
		else
			cout << "Easter is Sunday, " << "March " 
			<< day << ", " << year << "." << "\n\n";
	}
	else  // year is not in the range
		cout << "\n\aInvalid Year (must be between 1982 and 2048)." 
		<< "\n\n";

	system("pause");

	return 0;

}

