Bloomberg Interview Question

How to find out whether a number is odd or even.

Interview Answers

Anonymous

Mar 4, 2010

look at last bit.

3

Anonymous

May 26, 2011

Just check if the first bit is 1.

1

Anonymous

May 20, 2010

#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; } } } }

Anonymous

Jul 21, 2010

or & with 1, if ans = 0 even else odd

1