Sunday, September 5, 2010

Program to enter an integer and find out if it is even or odd

#include
#include

void main()
{
clrscr();
int x;
cout << "Enter an integer : ";
cin>>x;
if(x%2==0)
cout << "The number " << x << " is even.";
else
cout << "The number " << x << " is odd.";
getch();
}

0 comments:

Post a Comment