0% found this document useful (0 votes)
43 views29 pages

COA Chapter 3

The document discusses different number systems used in computer science, including binary, octal, decimal, and hexadecimal. It explains that each number system has a base with corresponding digits. Binary uses 0 and 1 with base 2. Octal uses digits 0-7 with base 8. Decimal uses 0-9 with base 10. Hexadecimal uses 0-9 and A-F with base 16. The document also provides steps for converting between these number systems by breaking numbers into their place values in the given base.

Uploaded by

dagne
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views29 pages

COA Chapter 3

The document discusses different number systems used in computer science, including binary, octal, decimal, and hexadecimal. It explains that each number system has a base with corresponding digits. Binary uses 0 and 1 with base 2. Octal uses digits 0-7 with base 8. Decimal uses 0-9 with base 10. Hexadecimal uses 0-9 and A-F with base 16. The document also provides steps for converting between these number systems by breaking numbers into their place values in the given base.

Uploaded by

dagne
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 29

Chapter Three

Computer Application Prepared byDagne W. 1


Number System
• Number systems are the technique to represent
numbers in the computer architecture.
• Every values that you are saving or getting into/from
the computer memory has defined number system
Computer architecture support the following number
system
• Binary number system
• Octal number system
• Decimal number system
• Hexadecimal(hex)number system

Computer Application Prepared byDagne W. 2


Binary Number System

•A Binary number system has only two digits that are 0


and 1.
•Every number (value) represents with 0 and 1 in this
number system.
•The base of binary number system is 2, because it has
only two digits.

Computer Application Prepared byDagne W. 3


Octal Number System

• Octal number system has only eight (8) digits from 0 to


7.
•Every number (value) represents with 0,1,2,3,4,5,6 and 7
in this number system.
•The base of octal number system is 8, because it has only
8 digits.

Computer Application Prepared byDagne W. 4


Decimal Number system
Decimal number system has only ten (10) digits from 0
to 9.
Every number (value) represents with 0,1,2,3,4,5,6, 7,8
and 9 in this number system.
The base of decimal number system is 10, because it
has only 10 digits.

Computer Application Prepared byDagne W. 5


Hexadecimal Number System
A Hexadecimal number system has sixteen (16)
alphanumeric values from 0 to 9 and A to F.
Every number (value) represents with 0,1,2,3,4,5,6,
7,8,9,A,B,C,D,E and F in this number system.
The base of hexadecimal number system is 16, because
it has 16 alphanumeric values.
Here A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15.

Computer Application Prepared byDagne W. 6


Number System Conversion
There are three types of conversion:
 Decimal Number System to Other Base
 Other Base to Decimal Number System
 Other Base to Other Base

Computer Application Prepared byDagne W. 7


Number System…
• In computer science, there are four commonly used
bases - namely: base 2, base 8, base 10 and base 16. And
the number systems in these bases are binary, octal,
decimal and hexadecimal respectively.
• Note that: base n number system has n possible digits
and the digits are 0 to n-1
Summary of Number systems
Base Number System Possible
Symbols(digits)
2 Binary 0 and 1

8 Octal 0-7

10 Decimal 0-9

16 Hexadecimal 0-9 and A-F

Computer Application Prepared byDagne W. 8


Number System…
Decimal Binary Octal Hexa-decimal

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
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 Application Prepared byDagne W. 9
Conversion from One Base to Another
A number that is represented in any base can be converted to
decimal using the following steps:
Therefore, the general form of the given number is:
X= an x 10n + … + a1x101+a0x100 + a-1 x 10-1 + … + a-m x 10-m
n

= ∑ ai x 10i
i= -m

•Step 1. Represent the given number in its general form


•Step 2. Using decimal arithmetic simplify the general form
•Example: convert the following numbers to decimal
•a) (101.1)2

Computer Application Prepared byDagne W. 10


Conversion from One Base to Another
o Multiplication process
Solution
a(101.1)2 = 1x22 + 0x21 +1x20+1x2-1
= 1x4 + 0x2 + 1x1 + 1x ½
= 4 + 0 + 1 + 0.5
= (5.5)10
b) (101011)2
Solution
(101011)2=> 1 x 20 = 1
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
0 x 24 = 0
1 x 25 = 32
(43)10

Computer Application Prepared byDagne W. 11


Conversion from One Base to Another
Example:The general form of the decimal number 852.37
is equal to
8x102 +5 x101+ 2x100 +3x10-1 + 7x10-2
Likewise, substituting any base in place of 10 will give
the general form of a number to that radix or base.
 Example: (3462)8=3x83 + 4x82 + 6x81 + 2x80

Computer Application Prepared byDagne W. 12


Conversion from One Base to Another
Solution
c) (724)8
Solution
(724)8 => 4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
(468)10
d) (ABC)16
Solution
(ABC)16 => C x 160 = 12 x 1 = 12
B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
(2748)10
 

Computer Application Prepared byDagne W. 13


Conversion from One Base to Another
Solution
c) (724)8
Solution
(724)8 => 4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
(468)10
d) (ABC)16
Solution
(ABC)16 => C x 160 = 12 x 1 = 12
B x 161 = 11 x 16 = 176
A x 162 = 10 x 256 = 2560
(2748)10
 

Computer Application Prepared byDagne W. 14


Conversion from Base 10 to Another Bases

Step 1 Explained:
To convert a decimal integer to a base B integer number
1. Divide the given integer by the base B
2.Repeat step 1 until a 0 quotient is obtained.
Finally write the bits from bottom to top
Division process
Note for fraction part multiply by base and write the
bits from top to bottom(and take left side number) for
fraction after multiplication

Computer Application Prepared byDagne W. 15


Conversion from Base 10 to Another Bases
Example: Convert
a) 125 to binary
Solution

Computer Application Prepared byDagne W. 16


Conversion from Base 10 to Another Bases
b) 1234 to Octal
Solution

Computer Application Prepared byDagne W. 17


Conversion from Base 10 to Another Bases
c) 1234 to hexadecimal
Solution

Computer Application Prepared byDagne W. 18


Conversion from Base 10 to Another Bases
Example: convert the following decimal numbers to
binary
a) 3.14579

Computer Application Prepared byDagne W. 19


Conversion from Base 10 to Another Bases
 b) (.65)10 to binary
 Solution
 .65 x 2 = 1.3
 .30 x 2 = 0.60
 .60 x 2 = 1.20
 .20 x 2 = 0.40
 .40 x 2 = 0.80
 .80 x 2 = 1.60
 .60 x 2 = 1.20
.
.
. ____

 Ans: (101001)

Computer Application Prepared byDagne W. 20


Binary- to-Octal
Group the binary digits in triplets (three bits)
starting at the binary point to the right and to the
left and convert each of these to its octal equivalent
Independently simplify the general form of base.
You can add 0’s on the right for fractional part and left
for the integral part, if necessary, to form a complete
triplet
Example: Convert the following binary numbers to
octal
a) (1011010111)2
Solution

Computer Application Prepared byDagne W. 21


Binary- to-Octal

Computer Application Prepared byDagne W. 22


Octal-to-Binary
Write the binary triplets for each octal digits

Computer Application Prepared byDagne W. 23


Binary-to-Hexadecimal
Group the binary digits in quadruplets (four bits)
starting at the binary point to the right and to the
left and convert each of these quadruplets to its
hexadecimal equivalent
you can add 0’s on the right for fractional number or
left for integral number, if necessary, to form a
complete quadruplets

Computer Application Prepared byDagne W. 24


Binary-to-Hexadecimal

Computer Application Prepared byDagne W. 25


Hexadecimal-to-Binary
Write the binary quadruplet for each hexadecimal digits

Computer Application Prepared byDagne W. 26


Octal-to-Hexadecimal
This is equivalent to converting octal-to-binary
and then to-hexadecimal
Example: convert (1076)8 to hexadecimal

Computer Application Prepared byDagne W. 27


Hexadecimal-to-Octal
This is equivalent to converting hexadecimal-
to-binary and then to-octal
Example: convert (1F0C) 16 to octal

Computer Application Prepared byDagne W. 28


Thank You
Question?????

Computer Application Prepared byDagne W. 29

You might also like