C++ Program to Show Number is Even or Odd Without Using Modulus Operator

Write a program to show an inputted no is even or odd without the use of modulus operator.
- Program to Calculate the Factorial Using While
- C++ Take Input Name, Class, and Roll Number from User and Display
- C++ Implement Setw Manipulator in OOP
- C++ Find the Sum of Two Numbers [int a,b,c].
Algorithm
- Start.
- Read a number, n
- a= n-2*(int (n/2)).
- If a=0 display “The number is even” else display “The number is odd”
- End
Source Code
#include<iostream> #include<stdio.h> #include<conio.h> using namespace std; int main() { int n,a; cout<<"Enter a number:"; cin>>n; a=n-2*(int(n/2)); if(a==0) cout<<"The number is even"<<endl; else cout<<"The number is odd"<<endl; }