I am attempting to create a little sub program that reads a number rrom
the user then prints if it is odd or even. This is what I have come up with, but it keeps printing the number is odd. Is there anything I can do to change this?
Code:int main ( void )
{
int n;
cout << "Enter a number: ";
cin >> n;
if (( n % n ) / 2 )
cout << "\nThe number is even" << endl;
cout << "\nThe number is odd" << endl;
cin.get(); // freeze console window
cin.ignore();
return 0; // indicate program ended sucsessfully
}