Computer Number System
Computer Number System
number system
Learning objectives
At the end of the lesson, the students should be able to:
1. Explain and identify the different number systems
2. Convert decimal to binary, octal, and hexadecimal
3. Convert binary to decimal, octal and hexadecimal
4. Convert octal to decimal, binary, and hexadecimal
5. Convert hexadecimal to decimal, binary, and octal
Used by Used in
System Base Symbols
humans? computers?
Decimal 10 0, 1, … 9 Yes No
Binary 2 0, 1 No Yes
Octal 8 0, 1, … 7 No No
0, 1, … 9,
Hexadecimal 16 No No
A, B, … F
Computer Number System 3
Binary number system
Decimal Octal
Binary Hexadecimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
Computer Number System 9
Quantities/counting (2 of 3)
Decimal Binary Octal Hexa-decimal
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
Computer Number System 10
Quantities/counting (3 of 3)
Decimal Binary Octal Hexa-decimal
16 10000 20 10
17 10001 21 11
18 10010 22 12
19 10011 23 13
20 10100 24 14
21 10101 25 15
22 10110 26 16
23 10111 27 17
Computer Number System 11
Summary of the
conversion method
To Base
From Base 2 8 16 10
Group binary digits by Group binary digits by Expand number and
2 3, convert 4, convert convert base 2 digits
to base 10
Convert each octal Convert to base 2, Expand number and
8 digit to 3 binary digits then to base 16 convert base 8 digits
to base 10
Convert each Convert to base 2, Expand number and
16 hexadecimal digit to 4 then to base 8 convert base 16 digits
binary digits to base 10
Divide number Divide number Divide number
repeatedly by 2; use repeatedly by 8; use repeatedly by 16; use
10
remainders as an remainders as an remainders as an
answer answer answer
Computer Number System 12
Positional notation
Base
Decimal Octal
Binary Hexadecimal
•Binary to Decimal
•Octal to Decimal
•Hexadecimal to Decimal
Decimal Octal
Binary Hexadecimal
1010112 => 1 x 20 = 1
1 x 21 = 2
Bit “0” 0 x 22 = 0
1 x 23 = 8
0 x 24 = 0
1 x 25 = 32
4310
Computer Number System 20
Octal to decimal
Decimal Octal
Binary Hexadecimal
7248 => 4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
46810
Decimal Octal
Binary Hexadecimal
•Decimal to Binary
•Octal to Binary
•Hexadecimal to Binary
Decimal Octal
Binary Hexadecimal
12510 = 11111012
Computer Number System 30
octal to binary
Decimal Octal
Binary Hexadecimal
7058 = ?2
7 0 5
7058 = 1110001012
Decimal Octal
Binary Hexadecimal
10AF16 = ?2
1 0 A F
10AF16 = 00010000101011112
•Decimal to Octal
•Decimal to Binary
Decimal Octal
Binary Hexadecimal
• Divide by 8
• Keep track of the remainder
8 1234
8 154 2
8 19 2
8 2 3
0 2
123410 = 23228
Decimal Octal
Binary Hexadecimal
• Divide by 16
• Keep track of the remainder
123410 = ?16
16 1234
16 77 2
16 4 13 = D
0 4
123410 = 4D216
Computer Number System 43
Converting
base 2 to base 8, 16
•Binary to Octal
•Binary to Hexadecimal
Decimal Octal
Binary Hexadecimal
10110101112 = ?8
1 3 2 7
10110101112 = 13278
Decimal Octal
Binary Hexadecimal
10101110112 = ?16
10 1011 1011
2 B B
10101110112 = 2BB16
•Octal to Hexadecimal
•Hexadecimal to Octal
Decimal Octal
Binary Hexadecimal
2 3 E
10768 = 23E16
Computer Number System 54
hexadecimal to octal
Decimal Octal
Binary Hexadecimal
1 7 4 1 4
1F0C16 = 174148
Computer Number System 57
exercise
33
1110101
703
1AF
33 100001 41 21
• Decimal (review) 35
x 105
175
000
+35 a
3675
29.8
101.1101
3.07
C.82