Back To C++ Flow of Control Index
if(num % 2) is equal to zero , number is even else number is odd
//program to check whether number entered is odd or even using if-else statement #include
#include
void main() { int a; clrscr(); cout<<"enter a value for a"; cin>>a; if(a%2==0) { cout<<"a is a even number"; } else { cout<<"a is a odd number"; } getch(); }