C++ : check whether a number is odd or even


#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int n;
cout<<"Enter any number : ";
cin>>n;
if(n%2==0)
cout<<n<<" is even";
else
cout<<n<<" is odd";
getch();
return(0);
}

No comments:

Post a Comment