This is a basic Cpp program which checks whether the given number is even or odd.
Generally if a number is divisible by 2 then we call that number as an even number else it is an odd number.For checking whether a number is divisible by 2 we find the remainder of the given number when divided by 2.If the remainder is 0 we say that the number is EVEN else it is ODD.
PROGRAM :
OUTPUT :
Generally if a number is divisible by 2 then we call that number as an even number else it is an odd number.For checking whether a number is divisible by 2 we find the remainder of the given number when divided by 2.If the remainder is 0 we say that the number is EVEN else it is ODD.
PROGRAM :
#include <iostream>
using namespace std;
int main()
{
int n;
cout << "Enter any number : \t" ;
cin >> n ;
if(n%2 == 0)
cout << n << " is EVEN number " << endl;
else
cout << n << " is ODD number " << endl;
return 0;
}
OUTPUT :
| Cpp - Even Or Odd |
No comments:
Post a Comment