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!
download android app

Popular C++ Examples









codesadda.com

Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube