0

Alright so my task was to make a program in C++ that when entering a year would output the date easter landed on and this is what we were given

a=year MOD 19

b=year/100

c=year MOD 100

d=b/4

e=b MOD 4

f=(b+8)/25

g=(b-f+1)/3

h=(19a+b-d-g+15) MOD 30

i=c/4

k=c MOD 4

m=(32+2e+2i-h-k) MOD 7

n=(a+11h+22m)/451

Easter Month = (h+m-7n+114)/31 [3=March, 4=April]

Easter Day = 1+(h+m-7n+114) MOD 31

alright so thats the big ol' long equation we were given to find the date easter lands on for a given year, so the program i wrote is:

```
#include <iostream>
using namespace std;
int main()
{
int year;
int a = year % 19;
int b = year/100;
int c = year % 100;
int d = b/4;
int e = b % 4;
int f = (b+8)/25;
int g = (b-f+1)/3;
int h = (19*a+b-d-g+15) % 30;
int i = c/4;
int k = c % 4;
int m = (32+2*e+2*i-h-k) % 7;
int n = (a+11*h+22*m)/451;
int EasterMonth = (h+m-7*n+144)/31;
int EasterDay = 1+(h+m-7*n+144) % 31;
cout << "The following program will output the date of which easter fell on or will fall on for any given year inputted according to the Gregorian Calender" << endl;
cout << "Enter desired year:" << endl;
cin >> year;//The 4-digit year.
cout << "Easter in the year " << year << " will fall on " << endl;
if (EasterMonth=3)
cout << "March ";
else
cout << "April ";
cout << EasterDay << endl;
return 0;
}
```

Now everytime i enter a date no matter what the outcome i receive is March8. I was wondering if anyone could help me in showing me where my error is

*Edited 4 Years Ago by motrcolt*