Interview Question

Data Server Software Developer Coop Interview

-Ottawa, ON

Kinaxis

Come up a most efficient way to determine if a integer is odd or even.

AnswerAdd Tags

Interview Answers

2 Answers

1

int number = ...; if(number % 2) { odd } else { even }

Anonymous on

0

Compilers are smart enough to understand the result of n%2. Don't over-complicate it.

Anonymous on

Add Answers or Comments

To comment on this, Sign In or Sign Up.