Bitwise Interview Question

How to find that a given number is even or odd without using (if, else, any loop, conditional operator ,switch). You can use only a "%" sign.

Interview Answers

Anonymous

Nov 5, 2017

Use tertiary statement (n%2==0)?even:odd

1

Anonymous

Nov 5, 2017

Use tertiary statement (n%2==0)?even:odd

Anonymous

Nov 5, 2017

Use tertiary statement (n%2==0)?even:odd

Anonymous

Mar 9, 2015

main() { char ch[2][5]={"even","odd"}; cin>>num; cout<

14