1.0 COMPUTER SYSTEM
1.2 Number System and Representation
Learning Outcome
At the end of this topic, students should be able to:
d) Convert between Hexadecimal and Decimal
i) Convert Decimal to Hexadecimal
ii) Convert Hexadecimal to Decimal
e) Convert between Hexadecimal and Binary
i) Convert Binary to Hexadecimal
ii) Convert Hexadecimal to Binary
2
Recap - Introduction
Decimal
Hexadecimal Numbering Binary
System
3
A numbering system is a way of
representing numbers.
Recap Decimal Numbering System
Exp: 2310
The prefix “deci-” stands for 10.
The decimal number system is a Base 10
number system.
There are 10 symbols that represent
quantities:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Each place value in a decimal number is a
power of 10.
4
Decimal Number System
How 729 is represented in decimal numbers ?
102 101 100 729
7 x 100 2 x 10 9x1
700 + 20 +
9
5
Recap Binary Numbering System
The prefix “bi-” stands for 2. Exp: 10102
The binary number system is a Base 2 number
system.
There are 2 symbols that represent quantities,
called bits:
0, 1
Each place value in a binary number is a power
of 2.
6
Binary Number System
26 25 24 23 22 21 20
64 32 16 8 4 2 1
210 29 28 27
1024 512 256 128
7
Recap Hexadecimal Numbering
System
Exp: A616
The prefix “hexa-” stands for 6 and the prefix “deci-”
stands for 10.
The hexadecimal number system is a Base 16
number system.
There are 16 symbols that represent quantities:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Each place value in a hexadecimal number is a
power of 16.
8
Hexadecimal Symbol Decimal Equivalent Binary Equivalent 9
0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101
6 6 0110
7 7 0111
8 8 1000
9 9 1001
A 10 1010
B 11 1011
C 12 1100
D 13 1101
E 14 1110
F 15 1111
Conversion of Numbering System
Decimal
Hexadecimal Binary
10
1. Decimal to Binary - (base 10 to base 2)
• Division – Remainder Method
(Divide by 2, find the remainder) (2) Convert 15610 to binary
2 156
(1) Convert 2310 to binary
2 78 0
2 23 2 39 0
2 11 1 2 19 1
2 91
251 2 41
221 2 20
2 1 0 Ans : 101112 2 10
0 1 *Read the remainder from below 01
Ans : 100111002
11
1. Decimal to Binary - (base 10 to base 2)
• Division – Remainder Method
(Divide by 2, find the remainder)
Try this: Convert 7610 to binary
12
2. Binary to Decimal - (base 2 to base 10)
• Place Value Method
e.g. Convert 111012 to decimal
Place value Step 1 1 1 1 0 1
X XX XX
Step 2 16 8 4 2 1
(24 ) (23 ) (22) (21) (20)
Step 3 16 + 8 + 4 + 0 + 1
= 2910 13
2. Binary to Decimal - (base 2 to base 10)
• Place Value Method
Try this: Convert 1100112 to decimal
Step 1
Step 2
Step 3
14
Try the questions given.
a) Show the conversion of Binary number given to decimal number:
1) 00111001
2) 11001
3) 1111000
4) 11000111
b) Convert the given numbers below to binary number:
1) 5610
2) 3210
3) 2610
4) 1710
15
3. Decimal to Hexadecimal - (base 10 to base 16)
Hexadecimal Decimal
Symbol Equivalent
• Division – Remainder Method 00
11
(Divide by 16, find the remainder) 22
33
44
e.g. Convert 7710 to hex 55
66
77
88
16 77 99
A 10
B 11
12
16 4 13 = D Read the remainder as C
04 hex number D 13
E 14
= 4D16 F 15
16
3. Decimal to Hexadecimal - (base 10 to base 16)
• Division – Remainder Method
(Divide by 16, find the remainder)
Try this: Convert 9110 to hex
17
4. Hexadecimal To Decimal - (base 16 to base 10)
• Place Value Method
e.g. Convert 4D16 to decimal
Step 1 4 D Decimal equivalent
Step 2 Place value
Step 3 4 13
X X
16 1
(161) (160)
Step 4 64 + 13 = 7710
18
4. Hexadecimal To Decimal - (base 16 to base 10)
• Place Value Method
Try this: Convert AF1016 to decimal
Step 1
Step 2
Step 3
Step 4
19
Try the questions given.
a) Express the following numbers in hexadecimal numbers.
1) 2910
2) 2410
3) 3810
4) 6010
b) Convert the given numbers below to decimal numbers.
1) 4AF16
2) 10A 16
3) 11BC16
20
5. Hexadecimal to Binary - (base 16 to base 2)
• Step 1: Convert Hexadecimal to Decimal
Place Value Method
• Step 2: Convert Decimal to Binary
Division – Remainder Method
(Divide by 2, find the remainder)
21
5. Hexadecimal to Binary - (base 16 to base 2)
Step 1: Place Value Method
e.g. Convert F116 to decimal
Step 1 F 1 Decimal equivalent
Step 2 Place Value
Step 3 15 1
22
Step 4 X X
16 1
(161) (160)
240 + 1
= 24110
5. Hexadecimal to Binary - (base 16 to base 2)
Step 2: Division – Remainder Method 2 241 1
(Divide by 2, find the remainder) 2 120 0
2 60 0
e.g. Convert 24110 to binary 2 30 0
2 15 1
*Read the remainder from below 27 1
23 1
= 111100012 21 1
0 23
5. Hexadecimal to Binary - (base 16 to base 2)
Try this: Convert 1E16 to binary
1. Step 1 ?
2. Step 2 ?
24
5. Hexadecimal to Binary - (base 16 to base 2)
• 1 Hex digit = 4 Bits Simplified Method
e.g. Convert 9AF16 to binary
Break up each digit Step 1 9 A F
Decimal equivalent
Step 2 9 10 15
Place value
Group all digits Step 3 8 4 2 1 8 4 2 1 8 4 2 1
23222120 23222120 23222120
Step 4 1 0 0 1 1 0 1 0 1 1 1 1
= 1001101011112 25
6. Binary to Hexadecimal - (base 2 to base 16)
• Step 1: Convert Binary to Decimal
Place value method
• Step 2: Convert Decimal to Hex
Division – Remainder Method
(Divide by 16, find the remainder)
26
6. Binary to Hexadecimal - (base 2 to base 16)
Step 1: Place Value Method
e.g. Convert 101012 to decimal
Place Value Step 1 1 0 1 0 1
X X X X X
Step 2 16 8 4 2 1
(24 ) (23 ) (22) (21) (20)
Step 3 16 + 0+ 4+ 0+ 1
= 2110
27
6. Binary to Hexadecimal - (base 2 to base 16)
Step 2: Division – Remainder Method
(Divide by 16, find the remainder)
e.g. Convert 2110 to hex
16 21 5 Read the remainder as
16 1 1 hex number
0 = 1516
28
6. Binary to Hexadecimal - (base 2 to base 16)
Try this: Convert 111010012 to hex
1. Step 1 ?
2. Step 2 ?
29
6. Binary to Hexadecimal - (base 2 to base 16)
• 4 Bits = 1 Hex digit Simplified Method
e.g. Convert 10101111012 to hex
Group to 4 bits Step 1 0 0 1 0 1 0 1 1 1101
(R to L)
8421
Place value Step 2 8 4 2 1 8 4 2 1 23222120
Decimal equivalent 23222120 23222120
13
Hex equivalent Step 3 2 11
D
Step 4 2 B
= 2BD16
30
Try the questions given.
a. Convert the following hexadecimal numbers to binary numbers :
1) 11A16
2) 1CB16
3) F616
4) DB16
b. Convert the following binary numbers to hexadecimal numbers.
1) 110110012
2) 10111002
3) 1110010002
31
TO BASE
FROM 10 16
BASE (Decimal) (Hexadecimal)
2 Place Value Method Gr4obuiptst(o4 Simplify Method
Bits = 1 Hex digit)
(Binary) Step 1 1 1 1 0 1
Step 2 16 8 4 2 1 (R to L)
Place value
16x1 8x1 4x1 2x0 1x1 Step 1 0 0 1 0 1 0 1 1 1 1 0 1
(24 ) (23 ) (22) (21) (20)
Step 3 16 + 8 + 4 + 0 + 1 Step 2 8 4 2 1 8 4 2 1 8 4 2 1
23222120 23222120 23222120
Step 3 2 11 13
Step 4 2 B D
= 2910 Decimal Hex equivalent
equivalent
Place value
= 2BD16
32
TO BASE
FROM 2 10
BASE (Binary) (Decimal)
16 Simplify Method Place Value Method
(Hexa (1 Hex digit = 4 Bits)
decimal)
33
TO BASE
FROM 2 16
BASE (Binary) (Hexadecimal)
10 1. Division – Remainder Method 1. Division – Remainder Method
(Decimal) (Divide by 2, find the remainder) (Divide by 16, find the remainder)
34