A C++ program that inputs a number and finds whether it is even or odd.
#include<iostream>
#include<conio.h>
using namespace std;
main()
{
int n;
cout<<"Enter a number : ";
cin>>n;
if(n%2==0)
cout<<"\n"<<n<<" is even.";
else
cout<<n<<" is odd";
return 0;
}
Output:
Enter a number : 23
23 is odd
0 Comments