##
Check whether a given number is even or odd
October 11, 2016

Given a number, check whether it is even or odd. Examples: input: 2 output: even input: 5 output: odd One simple solution is to find remainder after dividing by 2. Odd A better solution is to use bitwise operators. We need to check whether last bit is 1 or not. If last bit is 1… Read More »