Computer Science, asked by austinawuah9, 4 months ago

write an algorithm to find whether a number is even or odd

Answers

Answered by Anonymous
2

Explanation:

A number is odd if it has 1 as its rightmost bit in bitwise representation. It is even if it has 0 as its rightmost bit in bitwise representation. This can be found by using bitwise AND on the number and 1. If the output obtained is 0, then the number is even and if the output obtained is 1, then the number is odd.

Similar questions