0% found this document useful (0 votes)
10 views4 pages

Understanding Decimal and Binary Systems

The document discusses the relationship between the decimal and binary number systems, focusing on how to determine the last bit of a number using bitwise operations. It explains that the last bit of an odd number is always 1, while for even numbers it is 0, and illustrates this with an example using the bitwise AND operation. The document emphasizes the importance of understanding these concepts for coding purposes.

Uploaded by

Divyank Rapria
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

Understanding Decimal and Binary Systems

The document discusses the relationship between the decimal and binary number systems, focusing on how to determine the last bit of a number using bitwise operations. It explains that the last bit of an odd number is always 1, while for even numbers it is 0, and illustrates this with an example using the bitwise AND operation. The document emphasizes the importance of understanding these concepts for coding purposes.

Uploaded by

Divyank Rapria
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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

You might also like