SlideShare a Scribd company logo
1
NUMBER SYSTEM AND
REPRESENTATION
2.2 Number System
2.2.1 Binary
2.2.2 Hexadecimal
2.2.3 Conversion Between Binary and
Hexadecimal
Chapter
PDT - 2017/2018
Define Number
System
● A set of numerals for representing
numbers
Decimal Numbers (base 10)
Binary Numbers (base 2)
Hexadecimal Numbers (base 16)
Page 260
Figure 5-2
8
Discovering Computers : Chapter 5
Decimal Numbers
● Consists of numbers 0-9
● Decimal digits are joined together to form
longer decimal numbers
● Example: 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,
12,………
● also known as the base 10 numbering system
8
6 1 5
6 x 10^2 1 x 10^1 5 x 10^0
6 x 100 1 x 10 5 x 1
600 + 10 + 5 = 615
At the end of this topic, students
should be able to:
represent data in binary forma)
1
NUMBER SYSTEM AND
REPRESENTATION
2.2.1 Binary
Chapter
PDT - 2017/2018
Binary Numbers
● Machine recognises two states: 0 (off) and 1
(on)
● Binary number represents numeric values
using two symbols, 0 and 1
● Eg : 111000, 101 111 111
8
Comparison Between Decimal Number
and Binary Number
8
DECIMAL BINARY
0 0
1 1
2 10
3 11
4 100
5 101
6 110
DECIMAL BINARY
7 111
8 1 000
9 1 001
10 1 010
11 1 011
. .
40 101 000
. .
At the end of this topic, students
should be able to:
represent data in hexadecimal forma)
1
NUMBER SYSTEM AND
REPRESENTATION
2.2.2 Hexadecimal
Chapter
PDT - 2017/2018
Hexadecimal Numbers
● Uses 16 symbols: 0,1,2, 3, 4, 5, 6, 7, 8, 9, A, B,
C, D, E and F.
● It can represent binary values in compact
form.
● 9B416
is example of hexadecimal numbers.
8
Comparison Between Decimal Number
and Hexadecimal Number
8
DECIMAL HEXADECIMAL
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
DECIMAL HEXADECIMAL
10 A
11 B
12 C
13 D
14 E
15 F
16 10
17 11
20 14
35 23
8
Decimal Hexadecimal Binary
0 0 0
1 1 1
2 2 10
3 3 11
4 4 100
5 5 101
6 6 110
7 7 111
8 8 1000
9 9 1001
10 A 1010
11 B 1011
12 C 1100
13 D 1101
14 E 1110
15 F 1111
Comparison Between Number System
At the end of this topic, students
should be able to:
a. convert from binary to hexadecimal
b. convert from hexadecimal to binary
1
NUMBER SYSTEM AND
REPRESENTATION
2.2.3 Conversion Between Binary and Hexadecimal
Chapter
PDT - 2017/2018
Conversion Between Number System
● Decimal to Binary
● Binary to Decimal
● Decimal to Hexadecimal
● Hexadecimal to Decimal
● Binary to Hexadecimal
● Hexadecimal to Binary
8
CONVERSION
Decimal to Binary conversion
Binary
number
2
2 ---- 0
---- 1
2
2
---- 1
---- 0
22
11
5
2
1
0 ---- 1
Hence, 22 = 10110 2
Eg 1: Convert the number 22 to the binary
number system. Solution : 22
=
2
2
Write from bottom to
top → left to right
Decimal to binary conversion
Eg 2: Convert the number 40 to the
binarynumber system. Solution : 40 =
2
2
2
2
2
2
2
40
20
10
5
2
1
0
---- 0
---- 0
---- 0
---- 1
---- 0
---- 1
Binary
number
Hence, 40 = 101000
2
Write from bottom to
top → left to right
Decimal to binary conversion
2
2
2
2
2
18
9
4
2
1
0
---- 0
---- 1
---- 0
---- 0
---- 1
Binary
number
Hence, 18 = 100102
Eg 3:Express 18 in binary number form
Solution 18 = 2
Write from bottom to
top → left to right
Decimal to binary conversion
CONVERSION
Binary to Decimal conversion
● In binary number, the column weights
(again from right to left) are as follows:
● Eg : convert 1011 2 to decimal number
Binary to Decimal conversion
1 0 1 1
1 x (2^3) 0 x (2^2) 1 x (2^1) 1 x (2^0)
1 x 8 0 x 4 1 x 2 1 x 1 Decimal number
8 0 2 1
8+0+2+1=1110
Binary to decimal conversion
CONVERSION
Eg 1: Convert the number 10112 to the
decimal
Hence, 10110 2 = 22
Eg 1: Convert the binary number 10110 2 to
decimal number
Solution:
1 0 1 1 0
1 x 2^4 0 x 2^3 1 x 2^2 1 x 2^1 0 x 2^0
2210
1 x 16 0 x 8 1 x 4 1 x 2 0 x 1
16 0 4 2 0
16 + 0 + 4 + 2 + 0 =
Binary to decimal conversion
CONVERSION
Eg 2: Convert the number 101102 to the
decimal
Eg 2 :Convert the binary number 1011100 2
to decimal number
Solution:
Hence, 1 011 100 2 = 92
1 0 1 1 1 0 0
1 x 2^6 0 x 2^5 1 x 2^4 1 x 2^3 1 x 2^2 0 x 2^1 0 x 2^0
9210
1 0 1 1 1 0 0
1 x 64 0 x 32 1 x 16 1 x 8 1 x 4 0 x 2 0 x 1
64 + 0 + 16 + 8 + 4 + 0 + 0
=
Binary to decimal conversion
CONVERSION
Eg 3: Convert the number 10111002 to the
decimal
CONVERSION
Decimal to Hexadecimal
conversion
16
16
16
1341
83
5
0
---- 3
---- 5
Eg 1: Convert the decimal number 1341 to
hexadecimal number
Hence,1341 = 53D16
Decimal to hex conversion
Hex Number
Write from bottom to
top → left to right
---- 13 = D
Eg 2 : Convert the decimal number 860 to
hexadecimal number
16
16
16
860
53
3
0
---- 12 = C
---- 5
---- 3
Hence, 860 = 35C16
Hex Number
Decimal to hex conversion
Write from bottom to
top → left to right
16
16
16
2020
126
7
0
---- 4
---- 14 = E
---- 7
Eg 3 : Convert the decimal number 2020 to
hexadecimal number
Hex Number
Decimal to hex conversion
Hence, 2020 = 7E416
Write from bottom to
top → left to right
CONVERSION
Hexadecimal to Decimal
conversion
to decimal number● Convert
AFB216
Solution:
Hence, AFB216 =
44978
Eg 1 : Convert the hex number, AFB216
to decimal number
A F B 2
A x 16^3 F x 16^2 B x 16^1 2 x 16^0
4497810
10 x 4096 15 x 256 11 x 16 2 x 1
40960 + 3840 + 176 + 2 =
hex to decimal conversion
CONVERSION
Eg 1: Convert the number AFB16 to the
decimal
to decimal number● Convert
BA816
Solution:
Hence, BA816 =
2984
Eg 2 : Convert the hex number, BA816
to decimal number
B A 8
B x 6^2 A x 16^1 8 x16^0
298410
11 x 256 10 x 16 8 x 1
2816 + 160 + 8 =
hex to decimal conversion
CONVERSION
Eg 2: Convert the number BA816 to the
decimal
to decimal number● Convert AFFA16
Solution:
Hence, AFFA16 =
45050
Eg 3 : Convert the hex number, AFFA16
to decimal number
A F F A
A x 16^3 F x 16^2 F x 16^1 A x16^0
4505010
10 x 4096 15 x 256 15 x16 10 x
1
40960 + 3840 + 240 + 10 =
hex to decimal conversion
CONVERSION
Eg 3: Convert the number AFFA16 to the
decimal
CONVERSION
Binary to Hexadecimal
conversion
Binary to Hexadecimal conversion
● There are two ways on how to convert
the
binary to hexadecimal number.
● 1st way : Decimal
Hexadecimal
○ Binary
○ 2nd way :
○ Binary Hexadecimal
binary to hex conversion
Eg. 1: Convert the binary number 110102 to
hexadecimal 1st way
○ Binary Decimal
26
1
16
16
0
---- 10 = A
---- 1
Decimal Hexadecimal
Hence, 11010 2 = 1A16
1 1 0 1 0
1 x 2^4 1 x 2^3 0 x 2^2 1 x 2^1 0 x 2^0
26
1 x16 1 x8 0 x 4 1 x 2 0 x 1
16 + 8 + 0 + 2 + 0 =
Eg. 1: Convert the binary number 110102 to
hexadecimal 1st way
● Step 1: divide the given binary digit into 4 digit per
group from right to left.
1 1 0 1 0
● Step 2: Using 8421 table,
1 1 0 1 0
1
= 1
8 4
2
1
8 + 2
= 10
= A
8 4 2 1
Hence, 11010 2 =
1A16
Eg. 1: Convert the binary number 110102 to
hexadecimal 2nd way
Binary Decimal
binary to hex conversion
18
1
0
---- 2
---- 1
Decimal
16
16
Hexadecimal
Hence, 100102 = 1216
Hex number
Eg.2 :Convert the binary number 100102 to
hexadecimal 1st way
1 0 0 1 0
1 x 2^4 0 x 2^3 0 x 2^2 1 x 2^1 0 x 2^0
18
1 x 16 0 x 8 0 x 4 0 x 2 0 x 1
16 + 0 + 0 + 2 + 0 =
Eg. 2: Convert the binary number 100102 to
hexadecimal 1st way
Eg.2 :Convert the binary number 100102 to
hexadecimal 2nd way
● Step 1: divide the given binary digit into 4 digit per
group from right to left.
1 0 0 1 0
● Step 2: Using 8421 table,
1 0 0 1 0
1
= 1
8 4
2
1
2
= 2
8 4 2 1
Hence, 11010 2 =
1216
CONVERSION
Hexadecimal to Binary
conversion
Hexadecimal to Binary conversion
● There are two ways on how to convert
the
hexadecimal to binary number.
● 1st way : Decimal
Binary
○ Hexadecimal
○ 2nd way :
○ Hexadecimal Binary
binary to hex conversion
Eg 1: Convert the hexadecimal number
3FD to binary number 1st way
Hexadecimal Decimal
16^2 16^1 16^0
1021
3 F D
256 x3 16 x15 1 x 13
768 + 240 + 13 =
hex to binary conversion
Eg. 1: Convert the hexadecimal number
3FD16 to binary number 1st way
Hexadecimal Decimal
Binary number
De
2
2
2
2
1021
510 ---- 1
255 ---- 0
127 ---- 1
2 63 ---- 1
2 31 ---- 1
2 15 ---- 1
2 7 ---- 1
2 3 ---- 1
2 1 ---- 1 Hence, 3FD16 = 11111111012
0 ---- 1
cimal Binary
hex to binary conversion
Eg. 1: Convert the hexadecimal number
3FD16 to binary number 1st way
Eg 1: Convert the hexadecimal number
3FD to binary number 2nd way
Hence, 3FD16 = 11111111012
=8+4+1
= 13
=8+4+2+1
= 15
=2+1
= 3
3 F = 15 D = 13
3 15 13
8 4 2 1 8 4 2 1 8 4 2 1
0 0 1 1 1 1 1 1 1 1 0 1
Eg. 1: Convert the hexadecimal number
3FD16 to binary number 2nd way
hex to binary conversion
Eg 2: Convert the hexadecimal number 1A2
to binary number 1st way
hex to binary conversion
Hexadecimal Decimal Decimal Binary
2
2
2
2
2
2
2
2
2
2
---- 0
---- 1
---- 0
---- 0
---- 0
---- 1
---- 0
---- 1
---- 1
Hence, 1A216 = 1101000102
1 A 2
1 x 16^2 A x 16^1 2 x 16^0
418
1 x 256 10 x 16 2 x 1
256 + 160 + 2 =
418
209
104
52
26
13
6
3
1
0
Eg. 2: Convert the hexadecimal number
1A216 to binary number 1st way
DecimalHexadecimal Decimal Binary
hex to binary conversion
Eg 2: Convert the hexadecimal number
1A2 to binary number 2nd way
=2=8+2
= 10
=1
Hence, 1A216 = 1101000102
1 A 2
1 10 2
8 4 2 1 8 4 2 1 8 4 2 1
0 0 0 1 1 0 1 0 0 0 1 0
= 2= 8 + 2
= 10
= 1
Eg. 2: Convert the hexadecimal number
1A216 to binary number 2nd way
hex to binary conversion
UPS 2015/2016
Q: Given the Internet Protocol address of a
printer as 192.0.0.2. Convert the address to
hexadecimal number [2 marks]
A: C0.0.0.2

More Related Content

PDF
Slide03 Number System and Operations Part 1
PPTX
Number system
PPT
Chapter 2 Data Representation on CPU (part 1)
PPTX
Introducing to number system
PPTX
1.0 number bases form 5
PPTX
01 intro
PPTX
Data representation
PPTX
digital logic circuits, digital component
Slide03 Number System and Operations Part 1
Number system
Chapter 2 Data Representation on CPU (part 1)
Introducing to number system
1.0 number bases form 5
01 intro
Data representation
digital logic circuits, digital component

What's hot (17)

PDF
Digital and Logic Design Chapter 1 binary_systems
PPT
Math unit7 number system and bases
PDF
Number system utm notes
PPT
Binary number systems multiplication
PPTX
PPT
Bolum1cozumler
PDF
Number system
PPTX
PPT ON NUMBER SYSTEM
PPTX
Number Systems
PDF
Naskah Murid Modul 1 Number Bases
PDF
Number systems tutorial
PPTX
Digital Electronics and Computer Language
PPT
Numbersystemcont
PDF
Chapter 1 digital systems and binary numbers
PPT
L2 number
PPTX
Number system
Digital and Logic Design Chapter 1 binary_systems
Math unit7 number system and bases
Number system utm notes
Binary number systems multiplication
Bolum1cozumler
Number system
PPT ON NUMBER SYSTEM
Number Systems
Naskah Murid Modul 1 Number Bases
Number systems tutorial
Digital Electronics and Computer Language
Numbersystemcont
Chapter 1 digital systems and binary numbers
L2 number
Number system
Ad

Similar to PDT DC015 Chapter 2 Computer System 2017/2018 (d) (20)

PPTX
PST SC015 Chapter 2 Computer System 2017/2018
PPT
Number system on various number tyoes decimal
PPT
Number System- binary octal hexadecimal numbers
PPT
Binary number of number system in information communication technology lectur...
PPTX
Digital Logic Design.pptx
PPTX
Number Sytem Conversion & Binary Arithmetics.pptx
PPTX
micro tut1.pptx
PPT
ch3a-binary-numbers.ppt
PPT
conversion.ppt
PPT
lecture3_dec_bin_1.ppt
PPT
mmmmmmmmmmmmmmmmmmmmmmbinary-numbers.ppt
PPT
binary-numbers.ppt
PPT
ch3a-binary-numbers.ppt ch3a-binary-numbers.ppt ch3a-binary-numbers.ppt
PPT
Review on Number Systems: Decimal, Binary, and Hexadecimal
PPT
ch3a-binary-numbers.ppt
PPT
ch3a-binary-numbers.ppt
PPT
ch3a-binary-numbers.ppt
PPT
ch3a-binary-numbers.ppt-BINARY SYSTEM---
PPTX
UNIT - I.pptx
PPTX
UNIT - I.pptx
PST SC015 Chapter 2 Computer System 2017/2018
Number system on various number tyoes decimal
Number System- binary octal hexadecimal numbers
Binary number of number system in information communication technology lectur...
Digital Logic Design.pptx
Number Sytem Conversion & Binary Arithmetics.pptx
micro tut1.pptx
ch3a-binary-numbers.ppt
conversion.ppt
lecture3_dec_bin_1.ppt
mmmmmmmmmmmmmmmmmmmmmmbinary-numbers.ppt
binary-numbers.ppt
ch3a-binary-numbers.ppt ch3a-binary-numbers.ppt ch3a-binary-numbers.ppt
Review on Number Systems: Decimal, Binary, and Hexadecimal
ch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt-BINARY SYSTEM---
UNIT - I.pptx
UNIT - I.pptx
Ad

More from Fizaril Amzari Omar (20)

PDF
Chapter 7 Information System
PDF
Chapter 6 Database SC025 2017/2018
PDF
Chapter 5 Multimedia SC025 2017/2018
PPTX
PDT DC015 Chapter 2 Computer System 2017/2018 (m)
PPTX
PDT DC015 Chapter 2 Computer System 2017/2018 (k)
PPTX
PDT DC015 Chapter 2 Computer System 2017/2018 (j)
PPTX
PDT DC015 Chapter 2 Computer System 2017/2018 (i)
PPTX
PDT DC015 Chapter 2 Computer System 2017/2018 (g)
PPTX
PDT DC015 Chapter 2 Computer System 2017/2018 (f)
PPTX
PDT DC015 Chapter 2 Computer System 2017/2018 (e)
PPTX
PDT DC015 Chapter 2 System Concept 2017/2018 (a)
PPTX
PST SC015 Chapter 4 Comp. Ethics and Security 2017/2018
PPTX
PST SC015 Chapter 3 Internet Technology (V) 2017/2018
PPTX
PST SC015 Chapter 3 Internet Technology (IV) 2017/2018
PPTX
PST SC015 Chapter 3 Internet Technology (II) 2017/2018
PPTX
PST SC015 Chapter 3 Internet Technology (II) 2017/2018
PPTX
PST SC015 Chapter 3 Internet Technology (I) 2017/2018
PPTX
PST SC015 Chapter 2 Computer System (IV) 2017/2018
PPTX
PST SC015 Chapter 2 Computer System (III) 2017/2018
PPTX
PST SC015 Chapter 2 Computer System (II) 2017/2018
Chapter 7 Information System
Chapter 6 Database SC025 2017/2018
Chapter 5 Multimedia SC025 2017/2018
PDT DC015 Chapter 2 Computer System 2017/2018 (m)
PDT DC015 Chapter 2 Computer System 2017/2018 (k)
PDT DC015 Chapter 2 Computer System 2017/2018 (j)
PDT DC015 Chapter 2 Computer System 2017/2018 (i)
PDT DC015 Chapter 2 Computer System 2017/2018 (g)
PDT DC015 Chapter 2 Computer System 2017/2018 (f)
PDT DC015 Chapter 2 Computer System 2017/2018 (e)
PDT DC015 Chapter 2 System Concept 2017/2018 (a)
PST SC015 Chapter 4 Comp. Ethics and Security 2017/2018
PST SC015 Chapter 3 Internet Technology (V) 2017/2018
PST SC015 Chapter 3 Internet Technology (IV) 2017/2018
PST SC015 Chapter 3 Internet Technology (II) 2017/2018
PST SC015 Chapter 3 Internet Technology (II) 2017/2018
PST SC015 Chapter 3 Internet Technology (I) 2017/2018
PST SC015 Chapter 2 Computer System (IV) 2017/2018
PST SC015 Chapter 2 Computer System (III) 2017/2018
PST SC015 Chapter 2 Computer System (II) 2017/2018

Recently uploaded (20)

PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Pre independence Education in Inndia.pdf
PPTX
Pharma ospi slides which help in ospi learning
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Computing-Curriculum for Schools in Ghana
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Basic Mud Logging Guide for educational purpose
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Lesson notes of climatology university.
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
TR - Agricultural Crops Production NC III.pdf
Pre independence Education in Inndia.pdf
Pharma ospi slides which help in ospi learning
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPH.pptx obstetrics and gynecology in nursing
Computing-Curriculum for Schools in Ghana
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
VCE English Exam - Section C Student Revision Booklet
Microbial disease of the cardiovascular and lymphatic systems
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Anesthesia in Laparoscopic Surgery in India
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
O7-L3 Supply Chain Operations - ICLT Program
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Basic Mud Logging Guide for educational purpose
102 student loan defaulters named and shamed – Is someone you know on the list?
Lesson notes of climatology university.
3rd Neelam Sanjeevareddy Memorial Lecture.pdf

PDT DC015 Chapter 2 Computer System 2017/2018 (d)

  • 1. 1 NUMBER SYSTEM AND REPRESENTATION 2.2 Number System 2.2.1 Binary 2.2.2 Hexadecimal 2.2.3 Conversion Between Binary and Hexadecimal Chapter PDT - 2017/2018
  • 2. Define Number System ● A set of numerals for representing numbers Decimal Numbers (base 10) Binary Numbers (base 2) Hexadecimal Numbers (base 16) Page 260 Figure 5-2 8 Discovering Computers : Chapter 5
  • 3. Decimal Numbers ● Consists of numbers 0-9 ● Decimal digits are joined together to form longer decimal numbers ● Example: 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12,……… ● also known as the base 10 numbering system 8 6 1 5 6 x 10^2 1 x 10^1 5 x 10^0 6 x 100 1 x 10 5 x 1 600 + 10 + 5 = 615
  • 4. At the end of this topic, students should be able to: represent data in binary forma) 1 NUMBER SYSTEM AND REPRESENTATION 2.2.1 Binary Chapter PDT - 2017/2018
  • 5. Binary Numbers ● Machine recognises two states: 0 (off) and 1 (on) ● Binary number represents numeric values using two symbols, 0 and 1 ● Eg : 111000, 101 111 111 8
  • 6. Comparison Between Decimal Number and Binary Number 8 DECIMAL BINARY 0 0 1 1 2 10 3 11 4 100 5 101 6 110 DECIMAL BINARY 7 111 8 1 000 9 1 001 10 1 010 11 1 011 . . 40 101 000 . .
  • 7. At the end of this topic, students should be able to: represent data in hexadecimal forma) 1 NUMBER SYSTEM AND REPRESENTATION 2.2.2 Hexadecimal Chapter PDT - 2017/2018
  • 8. Hexadecimal Numbers ● Uses 16 symbols: 0,1,2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. ● It can represent binary values in compact form. ● 9B416 is example of hexadecimal numbers. 8
  • 9. Comparison Between Decimal Number and Hexadecimal Number 8 DECIMAL HEXADECIMAL 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 DECIMAL HEXADECIMAL 10 A 11 B 12 C 13 D 14 E 15 F 16 10 17 11 20 14 35 23
  • 10. 8 Decimal Hexadecimal Binary 0 0 0 1 1 1 2 2 10 3 3 11 4 4 100 5 5 101 6 6 110 7 7 111 8 8 1000 9 9 1001 10 A 1010 11 B 1011 12 C 1100 13 D 1101 14 E 1110 15 F 1111 Comparison Between Number System
  • 11. At the end of this topic, students should be able to: a. convert from binary to hexadecimal b. convert from hexadecimal to binary 1 NUMBER SYSTEM AND REPRESENTATION 2.2.3 Conversion Between Binary and Hexadecimal Chapter PDT - 2017/2018
  • 12. Conversion Between Number System ● Decimal to Binary ● Binary to Decimal ● Decimal to Hexadecimal ● Hexadecimal to Decimal ● Binary to Hexadecimal ● Hexadecimal to Binary 8
  • 14. Binary number 2 2 ---- 0 ---- 1 2 2 ---- 1 ---- 0 22 11 5 2 1 0 ---- 1 Hence, 22 = 10110 2 Eg 1: Convert the number 22 to the binary number system. Solution : 22 = 2 2 Write from bottom to top → left to right Decimal to binary conversion
  • 15. Eg 2: Convert the number 40 to the binarynumber system. Solution : 40 = 2 2 2 2 2 2 2 40 20 10 5 2 1 0 ---- 0 ---- 0 ---- 0 ---- 1 ---- 0 ---- 1 Binary number Hence, 40 = 101000 2 Write from bottom to top → left to right Decimal to binary conversion
  • 16. 2 2 2 2 2 18 9 4 2 1 0 ---- 0 ---- 1 ---- 0 ---- 0 ---- 1 Binary number Hence, 18 = 100102 Eg 3:Express 18 in binary number form Solution 18 = 2 Write from bottom to top → left to right Decimal to binary conversion
  • 18. ● In binary number, the column weights (again from right to left) are as follows: ● Eg : convert 1011 2 to decimal number Binary to Decimal conversion 1 0 1 1 1 x (2^3) 0 x (2^2) 1 x (2^1) 1 x (2^0) 1 x 8 0 x 4 1 x 2 1 x 1 Decimal number 8 0 2 1 8+0+2+1=1110 Binary to decimal conversion CONVERSION Eg 1: Convert the number 10112 to the decimal
  • 19. Hence, 10110 2 = 22 Eg 1: Convert the binary number 10110 2 to decimal number Solution: 1 0 1 1 0 1 x 2^4 0 x 2^3 1 x 2^2 1 x 2^1 0 x 2^0 2210 1 x 16 0 x 8 1 x 4 1 x 2 0 x 1 16 0 4 2 0 16 + 0 + 4 + 2 + 0 = Binary to decimal conversion CONVERSION Eg 2: Convert the number 101102 to the decimal
  • 20. Eg 2 :Convert the binary number 1011100 2 to decimal number Solution: Hence, 1 011 100 2 = 92 1 0 1 1 1 0 0 1 x 2^6 0 x 2^5 1 x 2^4 1 x 2^3 1 x 2^2 0 x 2^1 0 x 2^0 9210 1 0 1 1 1 0 0 1 x 64 0 x 32 1 x 16 1 x 8 1 x 4 0 x 2 0 x 1 64 + 0 + 16 + 8 + 4 + 0 + 0 = Binary to decimal conversion CONVERSION Eg 3: Convert the number 10111002 to the decimal
  • 22. 16 16 16 1341 83 5 0 ---- 3 ---- 5 Eg 1: Convert the decimal number 1341 to hexadecimal number Hence,1341 = 53D16 Decimal to hex conversion Hex Number Write from bottom to top → left to right ---- 13 = D
  • 23. Eg 2 : Convert the decimal number 860 to hexadecimal number 16 16 16 860 53 3 0 ---- 12 = C ---- 5 ---- 3 Hence, 860 = 35C16 Hex Number Decimal to hex conversion Write from bottom to top → left to right
  • 24. 16 16 16 2020 126 7 0 ---- 4 ---- 14 = E ---- 7 Eg 3 : Convert the decimal number 2020 to hexadecimal number Hex Number Decimal to hex conversion Hence, 2020 = 7E416 Write from bottom to top → left to right
  • 26. to decimal number● Convert AFB216 Solution: Hence, AFB216 = 44978 Eg 1 : Convert the hex number, AFB216 to decimal number A F B 2 A x 16^3 F x 16^2 B x 16^1 2 x 16^0 4497810 10 x 4096 15 x 256 11 x 16 2 x 1 40960 + 3840 + 176 + 2 = hex to decimal conversion CONVERSION Eg 1: Convert the number AFB16 to the decimal
  • 27. to decimal number● Convert BA816 Solution: Hence, BA816 = 2984 Eg 2 : Convert the hex number, BA816 to decimal number B A 8 B x 6^2 A x 16^1 8 x16^0 298410 11 x 256 10 x 16 8 x 1 2816 + 160 + 8 = hex to decimal conversion CONVERSION Eg 2: Convert the number BA816 to the decimal
  • 28. to decimal number● Convert AFFA16 Solution: Hence, AFFA16 = 45050 Eg 3 : Convert the hex number, AFFA16 to decimal number A F F A A x 16^3 F x 16^2 F x 16^1 A x16^0 4505010 10 x 4096 15 x 256 15 x16 10 x 1 40960 + 3840 + 240 + 10 = hex to decimal conversion CONVERSION Eg 3: Convert the number AFFA16 to the decimal
  • 30. Binary to Hexadecimal conversion ● There are two ways on how to convert the binary to hexadecimal number. ● 1st way : Decimal Hexadecimal ○ Binary ○ 2nd way : ○ Binary Hexadecimal binary to hex conversion
  • 31. Eg. 1: Convert the binary number 110102 to hexadecimal 1st way ○ Binary Decimal 26 1 16 16 0 ---- 10 = A ---- 1 Decimal Hexadecimal Hence, 11010 2 = 1A16 1 1 0 1 0 1 x 2^4 1 x 2^3 0 x 2^2 1 x 2^1 0 x 2^0 26 1 x16 1 x8 0 x 4 1 x 2 0 x 1 16 + 8 + 0 + 2 + 0 = Eg. 1: Convert the binary number 110102 to hexadecimal 1st way
  • 32. ● Step 1: divide the given binary digit into 4 digit per group from right to left. 1 1 0 1 0 ● Step 2: Using 8421 table, 1 1 0 1 0 1 = 1 8 4 2 1 8 + 2 = 10 = A 8 4 2 1 Hence, 11010 2 = 1A16 Eg. 1: Convert the binary number 110102 to hexadecimal 2nd way
  • 33. Binary Decimal binary to hex conversion 18 1 0 ---- 2 ---- 1 Decimal 16 16 Hexadecimal Hence, 100102 = 1216 Hex number Eg.2 :Convert the binary number 100102 to hexadecimal 1st way 1 0 0 1 0 1 x 2^4 0 x 2^3 0 x 2^2 1 x 2^1 0 x 2^0 18 1 x 16 0 x 8 0 x 4 0 x 2 0 x 1 16 + 0 + 0 + 2 + 0 = Eg. 2: Convert the binary number 100102 to hexadecimal 1st way
  • 34. Eg.2 :Convert the binary number 100102 to hexadecimal 2nd way ● Step 1: divide the given binary digit into 4 digit per group from right to left. 1 0 0 1 0 ● Step 2: Using 8421 table, 1 0 0 1 0 1 = 1 8 4 2 1 2 = 2 8 4 2 1 Hence, 11010 2 = 1216
  • 36. Hexadecimal to Binary conversion ● There are two ways on how to convert the hexadecimal to binary number. ● 1st way : Decimal Binary ○ Hexadecimal ○ 2nd way : ○ Hexadecimal Binary binary to hex conversion
  • 37. Eg 1: Convert the hexadecimal number 3FD to binary number 1st way Hexadecimal Decimal 16^2 16^1 16^0 1021 3 F D 256 x3 16 x15 1 x 13 768 + 240 + 13 = hex to binary conversion Eg. 1: Convert the hexadecimal number 3FD16 to binary number 1st way Hexadecimal Decimal
  • 38. Binary number De 2 2 2 2 1021 510 ---- 1 255 ---- 0 127 ---- 1 2 63 ---- 1 2 31 ---- 1 2 15 ---- 1 2 7 ---- 1 2 3 ---- 1 2 1 ---- 1 Hence, 3FD16 = 11111111012 0 ---- 1 cimal Binary hex to binary conversion Eg. 1: Convert the hexadecimal number 3FD16 to binary number 1st way
  • 39. Eg 1: Convert the hexadecimal number 3FD to binary number 2nd way Hence, 3FD16 = 11111111012 =8+4+1 = 13 =8+4+2+1 = 15 =2+1 = 3 3 F = 15 D = 13 3 15 13 8 4 2 1 8 4 2 1 8 4 2 1 0 0 1 1 1 1 1 1 1 1 0 1 Eg. 1: Convert the hexadecimal number 3FD16 to binary number 2nd way hex to binary conversion
  • 40. Eg 2: Convert the hexadecimal number 1A2 to binary number 1st way hex to binary conversion Hexadecimal Decimal Decimal Binary 2 2 2 2 2 2 2 2 2 2 ---- 0 ---- 1 ---- 0 ---- 0 ---- 0 ---- 1 ---- 0 ---- 1 ---- 1 Hence, 1A216 = 1101000102 1 A 2 1 x 16^2 A x 16^1 2 x 16^0 418 1 x 256 10 x 16 2 x 1 256 + 160 + 2 = 418 209 104 52 26 13 6 3 1 0 Eg. 2: Convert the hexadecimal number 1A216 to binary number 1st way DecimalHexadecimal Decimal Binary hex to binary conversion
  • 41. Eg 2: Convert the hexadecimal number 1A2 to binary number 2nd way =2=8+2 = 10 =1 Hence, 1A216 = 1101000102 1 A 2 1 10 2 8 4 2 1 8 4 2 1 8 4 2 1 0 0 0 1 1 0 1 0 0 0 1 0 = 2= 8 + 2 = 10 = 1 Eg. 2: Convert the hexadecimal number 1A216 to binary number 2nd way hex to binary conversion
  • 42. UPS 2015/2016 Q: Given the Internet Protocol address of a printer as 192.0.0.2. Convert the address to hexadecimal number [2 marks] A: C0.0.0.2