Sie sind auf Seite 1von 42

TOPIC 2:

COMPUTER SYSTEM
2.2 : Number System and
Representation

2.2 Number System and


Representation
2.2.1 Binary
2.2.2 Hexadecimal
2.2.3 Conversion between binary and
hexadecimal

2.2 Number System and Representation


Learning Outcomes:
At the end of this topic, students should be able
to:
(a) represent data in binary form.
(b) represent data in hexadecimal form.
(c) (i) Convert from binary to hexadecimal.
(ii) Convert from hexadecimal to binary.

Number System
Definition A way of representing numbers.
When we type some letters or words, the
computer translates them in numbers as
computers can understand only numbers.

Computer Number System


(1) Decimal Numbers
(2) Binary Numbers
(3) Hexadecimal Numbers

(1) Decimal Number System


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.

(1) Decimal Number System


3
10

2
10

1
10

0
10

1000

100

10

(1) Decimal Number System


How 729 is represented in decimal numbers ?

102

101

100

7 x 100

2 x 10

9x1

700 +

20 +

729

(2) Binary Number System


The prefix bi- stands for 2.
The binary number system is a Base 2 number

system.
There are 2 symbols that represent quantities:
0, 1
Each place value in a binary number is a power
of 2.
9

(2) Binary Number System

26

25

24

23

22

21

20

64 32

16

210

29

28

27

1024

512

256

128
10

Comparison between decimal number


and binary numbers
Binary

Decima
l
9

10

1010

10

11

1011

11

100

12

1100

101

13

1101

110

14

1110

111

15

1111

Decimal

Binary

1000

1001

11

(3) Hexadecimal Number System


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.
12

(3) Hexadecimal Number System


We use hexadecimal numbers as shorthand for

binary numbers.
Each group of four binary digits can be
represented by a single hexadecimal digit.

13

(3) Hexadecimal Number System


Dec

Bin

Hex

Dec

Bin

Hex

1000

1001

10

10

1010

11

11

1011

100

12

1100

101

13

1101

110

14

1110

111

15

1111

14

CONVERSION:
(1) Decimal to binary
(2) Binary to decimal
(3) Decimal to hexadecimal
(4) Hexadecimal to decimal
(5) Binary to hexadecimal
(6) Hexadecimal to binary
15

(1) Decimal to binary


Steps:

Divide the decimal number youre trying to


convert by 2 in regular long division until you
have a final remainder.

16

(1) Decimal to binary example 1


This example converts 22 to binary
2

22

11

Read from below to top

Answer: 101102
17

(1) Decimal to binary example 2


This example converts 40 to binary
2

40

20

10

1
0

Read from below to top

Answer: 1010002
18

(1) Decimal to binary example 3


This example converts 73 to binary
2

73

36

18

2
1

Read from below to top

Answer: 10010012
19

(2) Binary to decimal


Steps:

Write the binary place value over each digit in the


binary number being converted.
Add up all of the place values that have a 1 in
them.

20

(2) Binary to decimal example 1


This example converts 11001 to decimal

16

1
16 +

1
8+

1
1

Answer 2510
21

(2) Binary to decimal example 2


This example converts 1111000 to decimal

64

32

16

1
1
1
64 + 32 + 16 +

1
8

Answer 12010
22

(2) Binary to decimal example 3


This example converts 11000111 to decimal

128

64

1
1
128 + 64 +

32 16

1
4+

1
2+

1
1

Answer 19910
23

(3) Decimal to hexadecimal


Steps:
There are two methods to choose from:
Do a decimal-to-binary conversion and then a
binary-to-hexadecimal conversion.
Do a direct conversion using the repeated
division method.
Since this is a conversion to hexadecimal, 16
is the divisor each time.
24

(3) Decimal to hexadecimal


Note:
Since you are dividing by 16 in the repeated
division method for decimal-to-hex conversion,
you could end up with remainders of anywhere
from 0 to 15.
If a remainder is 10 to 15, you convert it to the
single hex symbol when you add the digit to the
hex number youre building.

25

(3) Decimal to hexadecimal example 1


This example converts 18 to hexadecimal
16

18

16

Read from below to top

Answer: 1216
26

(3) Decimal to hexadecimal example 2


This example converts 63 to hexadecimal
16

63

16

15

Read from below to top

Answer: 3F16
27

(3) Decimal to hexadecimal example 3


This example converts 270 to hexadecimal
16

270

16

16

14

1
6

Read from below to top

Answer: 10E16
28

(3) Decimal to hexadecimal example 4


This example converts 672 to hexadecimal
16

672

16

42

1
6

10

Read from below to top

Answer: 2A016
29

(4) Hexadecimal to decimal


Steps:

Multiply each digit of the hex number by its place


value and add the results.

30

(4) Hexadecimal to decimal example 1


This example converts 4C3 to decimal

256

16

4
C
3
4 x 256 12 x 16 3 x 1
1024 + 192 +
3
Answer 121910

31

(4) Hexadecimal to decimal example 2


This example converts 1B5D to decimal

4096

256

1
B
1 x 4096 11 x 256
4096 +
2816 +

16

5
D
5 x 16 13 x 1
80 +
13

Answer 700510

32

(4) Hexadecimal to decimal example 3


This example converts 2014 to decimal

4096

256

16

2
2 x 4096
8192 +

0
0 x 256
0+

1
1 x 16
16 +

4
4x1
4

Answer 821210

33

(5) Binary to hexadecimal


Steps:
Starting with the LEAST SIGNIFICANT digit,
mark off the digits in groups of 4.
e.g: 101100
0010

1100

Convert each group of four digits to its


hexadecimal character.
34

(5) Binary to hexadecimal example 1


This example converts 111101 to hexadecimal

8 4 2 1

8 4 2 1

0 0 1 1
2+1
3

1 1 0 1
8+4+1
13

Answer 3D16

35

(5) Binary to hexadecimal example 2


This example converts 101000101011 to
hexadecimal

8 4 2 1

8 4 2 1

8 4 2 1

1 0 1 0
8+2
10

0 0 1 0
2
2

1 0 1 1
8+2+1
11

Answer A2B16

36

(5) Binary to hexadecimal example 3


This example converts 100001110000 to
hexadecimal

8 4 2 1

8 4 2 1

8 4 2 1

1 0 0 0
8
8

0 1 1 1
4+2+1
7

0 0 0 0
0
0

Answer 87016

37

(6) Hexadecimal to binary


Steps:
Converting hexadecimal numbers to binary
is just the reverse operation of converting
binary to hexadecimal.
Just convert each hexadecimal digit to its
four-bit binary pattern. The resulting set of
1s and 0s is the binary equivalent of the
hexadecimal number.

38

(6) Hexadecimal to binary example 1


This example converts 9616 to binary

8 4 2 1

8 4 2 1

9
1 0 0 1

6
0 1 1 0

Answer 100101102
39

(6) Hexadecimal to binary example 2


This example converts BFF16 to binary

8 4 2 1

8 4 2 1

8 4 2 1

B (11)
1 0 1 1

F (15)
1 1 1 1

F (15)
1 1 1 1

Answer 1011111111112
40

(6) Hexadecimal to binary example 3


This example converts E0416 to binary

8 4 2 1

8 4 2 1

8 4 2 1

E (14)
1 1 1 0

0
0 0 0 0

4
0 1 0 0

Answer 1110000001002
41

Number system definition


Decimal numbers concept
Binary numbers concept
Hexadecimal numbers concept
Six (6) types of conversion

Dec Bin
Bin Dec
Dec Hex
Hex Dec
Bin Hex
Hex Bin
42

Das könnte Ihnen auch gefallen