Simple modulus problem...
I'm working on a program to calculate what day Easter falls on, but I'm getting garbage as answers. So I've been trying to isolate the problem working on one of my statements finding the remainder.
Here's what I have.
int year, a;
a = year % 19;
cout << "Enter Year: ":
cin >> year;
cout << a;
When I enter 2013 for my year, my output is 16 when it should be 18....What am I doing wrong?
Re: Simple modulus problem...
Nvm, I have solved the problem...I needed to put the a= year % 19; statement after cin >> year;
Re: Simple modulus problem...
It's a good example of the causality principle. Cause precedes effect. :)