Decimal and Binary System
12 January 2022 18:26
ignore 0 and add of 1
to write code understand this
because in binary last bit of odd is always 1
and for even its 0
Decimal and Binary Number System Page 1
in n&1 it only check last bit of n always so we get ans
from that for last bit as 1 or 0
then we right shift to know other and which also
changes that number in decimal as written below
reason : 6&1
6reason
= 0000110is
1=
x = 0000001
6 = 00000110
1
ans= = 00000001
0000000
----------------
x & 1& =
take 00000000 0corresponding
(intersection) (even) to
that bit
take & corresponding to that
bit
Decimal and Binary Number System Page 2
Decimal and Binary Number System Page 3
Decimal and Binary Number System Page 4