Wednesday 22 January 2020

Program to check odd or even number in CPP

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

}

Output
Enter a number : 5
The number is odd

No comments:

Post a Comment