Loading...
Engaged Employer
How to find out whether a number is odd or even.
Anonymous
look at last bit.
Just check if the first bit is 1.
#include using namespace std; int main () { int num; cout > num; if (num % 2) { cout << "This number is odd." << endl; }else { cout << "This number is even." << endl; return 0; } } } }
or & with 1, if ans = 0 even else odd
Check out your Company Bowl for anonymous work chats.
Get actionable career advice tailored to you by joining more bowls.
Stay ahead in opportunities and insider tips by following your dream companies.
Get personalized job recommendations and updates by starting your searches.