1 Answer Found

The simple way is to just check the number mod 2. If you get 1 it'sodd, otherwise even. The somewhat faster way on many systems(although it probably won't matter unless you execute this codemillions of times in a loop) would be to check the bitwise and of thenumber with 1. Again, if the result is 1 the number is odd,otherwise even.