C++ Program to Check Whether a Number is Odd or Even



In this program we will take number from user as input and check if the entered number is odd number or even number.



  1. //C++ Program to Check Whether a Number is Odd or Even
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6. int a, b;
  7. cout<<"Enter an integer: ";
  8. cin>>a;
  9. if(a%2==0)
  10. {
  11. cout<<"Entered number is even";
  12. }
  13. else
  14. {
  15. cout<<"Entered number is odd";
  16. }
  17. return 0;
  18. }

Output


Output!