Use bit wise and (&) operator to check whether a particular bit is on or off.
Example:
ans = paticular bit value & 1
if ans is 1 then the bit is set i.e on else it is off, i.e not set.
variable=CHECK_BIT(temp, 3) if the variable is 1. it will on else off. In c++ you could use std::bitset.
In a 32 bit only one bit is on, with out using loops, goto, or recursion how to find out which position is on? example : 4 ---> 2nd bit ( 0000 0100)