+ 2
Find a number the number which is entered by the user is even or odd without using modules (%) operator?
not use the ℅ operator in a whole program there are two ways to write this program other then % operator..
3 Respuestas
+ 3
simple solution is:
if((number / 2)*2==number)
{
printf(" Even number");
}
else
{
printf("Odd Number");
}
+ 2
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int a;
cin>>a;
a = abs(a);
if((a/2) == (a+1)/2)
cout<<"even"<<endl;
else
cout<<"odd"<<endl;
}
+ 1
there is one more way any one tell me..