In this post we are going to write a C++ program to find out the given number is odd or even. user will enter a number and program will print number is odd or even.
C++ program to find out given number is odd or even
#include<iostream> #include<conio.h> int main(void) { int n; std::cout<<"Enter the number = "; std::cin>>n; if(n%2==0) std::cout<<"The number is even"; else std::cout<<"The number is odd"; return 0; }
Output
Enter the number = 5 The number is odd
0 Comments