Welcome..!!

Please visit http://csprograms.in/ for more Computer Science programs.

Wednesday 14 March 2012

9. C++ program to find if the given number is even or odd.


#include <iostream>
int main()
{
int p,q;
cout <<"enter the number \n";
cin >>p;
cout <<"the given number is \n"<<n;
q=p%2;
if(q==0)
cout << p<<" is even number \n";
else
cout <<p<<" is odd number \n";
return 0;
}

No comments:

Post a Comment