Write a complete program in C ++ to calculate the day Easter will fall on based on these INTEGER equations by inputting the integer year and outputting the date of Easter.
Y = Year read in
N = Y - 1900
A = N - (N/19)*19
B = (7*A + 1)/19
C = 11*A + 4 - B
M = C - (C/29)*29
Q = N/4
S = N + Q + 31 - M
W = S - (S/7)*7
DATE = 25 - M - W
If DATE = 0 then Easter is March, 31
If DATE < 0 then Easter is March, (31 + DATE)
If DATE > 0 then Easter is April, DATE
#include <iostream> using namespace std; int main() { int year; cout << "Enter year: "; cin >> year; int N = year - 1900; int A = N - (N/19)*19; int B = (7*A + 1)/19; int C = 11*A + 4 - B; int M = C - (C/29)*29; int Q = N/4; int S = N + Q + 31 - M; int W = S - (S/7)*7; int DATE = 25 - M - W; if (DATE == 0) { cout << "easter is on March, 31" << endl; } else if (DATE < 0) { cout << "easter is on March, " << 31+DATE << endl; } else { cout << "easter is on April, " << DATE << endl; } return 0; }
Get Answers For Free
Most questions answered within 1 hours.