c++ program to check whether a number is odd or even
source code :
#include<iostream>
using namespace std;
int main(){
int t;
cout<<"Enter the number of test cases : "<<endl;
cin>>t;
for(int i=1;i<=t;i++){
int n;
cout<<"Enter the number you want to check :"<<endl;
cin>>n;
if(n==0)
cout<<"zero"<<endl;
else if (n%2==0)//% modulus and represent the remainder
cout<<"even number"<<endl;
else
cout<<"odd number"<<endl;
}
return 0;
}
output :
ConversionConversion EmoticonEmoticon