LU1 - Data Representation and Storage
1. Decimal, Binary and Hexadecimal Number Systems
Decimal (Base-10) Binary (Base-2) Hexadecimal (Base-16)
Binary Decimal Decimal
● Continuously divide by 2 ● Order the binary number in ● Order the hex number in
● Write down the remainder columns with increasing columns with increasing
● Repeat until the quotient is 0 powers of 2 powers of 16
● Read the remainders from ● Going from right to left, ● Going from right to left,
bottom to top starting at 0 starting at 0
● Multiply the bit by the ● Multiply the integer value
Base 140 Remainder
power of 2 in its column by the power of 16 in its
2 70 0 column
2 35 0 27 26 25 24 23 22 21 20 161 160
2 17 1 1 0 0 0 1 1 0 0
8 C
2 8 1
2 x 1 = 128 +
7
2 x0=0 6
8 x 161 12 x 160
2 4 0 25 x 0 = 0 + 24 x 0 = 0
2 x1=8
3
+ 22 x 1 = 4
128 12
2 2 0
2 x0=0
1
+ 20 x 0 = 0
1000 11002 = 14010
2 1 0 128 + 12 = 140
2 0 1
8C16 = 14010
14010 = 1000 11002
Hexadecimal Hexadecimal Binary
● Continuously divide by 16 ● Number of bits must be a ● First convert to decimal as
● Write down the remainder multiple of 4 shown above
● Repeat until the quotient is 0 ● Leading zeros must be ● Then use the decimal
● Read the remainders from added method to convert to
bottom to top ● Split the binary number into binary
groups of 4 bits
0 1 2 3 4 5 6 7 8 9
● Multiply each bit by the
0 1 2 3 4 5 6 7 8 9 multiple of 2
● Match the Hex value
10 11 12 13 14
1 0 0 0 1 1 0 0
A B C D E
x x x x x x x x
23 22 21 20 23 22 21 20
8C16 = 1000 11002
Base 140 Remainder
8 0 0 0 8 4 0 0
16 8 12
8=8 12 = c
16 0 8
161 162
8=8 12 = C 8=8
8 C
14010 = 8C16
1000 11002 = 8C16
3