C++ integer question

I need help with an integer question please tell me what I am doing wrong. The function bascially says what I need to output.

#include<iostream>
using namespace std;


int main()
{
int a, b;

cout << "Enter two integers: ";
cin >> a >> b;
cout << endl;

cout << "The two integers entered are " << a
<< " and " << b << endl;


if(a%2 == 0 && b%2 == 0 )
cout << "Both are even";
else if(a%2 == 1 && b%2 == 1 )
cout << "Both are odd";
else
cout << "One is even and one is odd";


system("pause");

}
Last edited on
What's wrong with it? It works okay for me.
WTF?? It wasnt working a little bit ago. I guess I messed with it before posting it and didnt realize I fixed it. My bad.
Topic archived. No new replies allowed.