In: Computer Science
Write a program to test whether a number provided from key board input is either odd or even. Don't forget the case that 0 is an even number.
for C++ please
CODE:
#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
if(n==0 || n%2==0)
{
cout<<"EVEN NUMBER";
}
else
{
cout<<"ODD NUMBER";
}
return 0;
}
OUTPUT:
NOTE:
IF YOU HAVE ANY DOUBTS, PLEASE DO ASK IN THE COMMENT SECTION, THANK YOU!