Write a Program To Check Even Or Odd Number Using Bitwise Operator
This page has a C program to check Even or Odd using Bitwise Operator. Even number is an integer number which can be dividable by 2
Logic to check even or odd using bitwise operator To check whether a number is even or odd we need to figure out if LSB is set or not. We use Bitwise AND & operator to check whether a bit is set or not. Similarly on performing num & 1 it return LSB of num . If LSB is 1 then the given number is odd otherwise even.
Ещё видео!