1 = 0001 2 = 0010
3 =
0011 4 = 0100
5 =
0101 6 = 0110
7 =
0111 8 = 1000
For odd
number n&1 will be = 1
And even
number n&1 will be = 0
Code :
#include<bits/stdc++.h> using namespace std; int main() { int
t,n,i,f;
cin>>t; while(t--) {
cin>>n; // n<= 10^10
if((n&1) == 1)
cout<<"odd\n"; else
cout<<"even\n"; } } |
Comments
Post a Comment