Vous êtes sur la page 1sur 9

# INTRODUCTION TO COMPUTER LECTURE 02

NUMBER SYSTEM
As we know every computer stores numbers, letters and other special
characters in a code form. Before going into the details of these codes, it is
essential to have a basic understanding of the number system.
Number systems are basically of two types:
i) Non positional number system
ii) Positional number system.

## i) Non-Positional Number System

In early day, human beings counted on fingers, when ten fingers were not
adequate, stones, pebbles, or sticks we used to indicate values. This
method of counting using an additive approach is called non-Positional
Number System. In this system, we have symbols such as I for 1, II for 2,
III for 3, IIII for 4, IIIII for 5 etc. Since it is very difficult to perform
arithmetic operations with such a number system.

## ii) Positional Number System

In a positional Number system there are only a few symbols called digits,
and these symbols represents different values, depending on the position
they occupy in the number. The value of each digit in such a number
determined by three considerations.
a) The digit itself.
b) The position of the digit.
c) The base of the number system.
The number system that we use in our daily life is called the decimal number
system. In this system the base is equal to 10 because there are altogether ten
digits used in this number system. E.g. the decimal number 2586 written as
(2586)10 consists of the digit 6 in the units position, 8 in the ten position, 5 in the
hundreds position and 2 in the thousands position and its value can be written as :
(2x1000) + (5x100) + (8x10) + (6x1)
OR 2000 + 500 + 80 + +6 = 2586

## Some of the number systems commonly used in computer design

and by computer professionals are discussed bellow.
1. BINARY NUMBER SYSTEM
The binary number system is exactly like the decimal system except that
the base is 2 instead of 10. We have only two digits(0 and 1) that can be
used in this number system. Each position in a binary number represents
a power of the base (2). E.g. the decimal 21 is equivalent of the binary
number 10101 written as

## (10101)2 is (1x 24) + (0x 23 ) + (1x22) + (0x21) + (1x20)

=16 + 0 + 4 + 0 + 1
= 21

1
INTRODUCTION TO COMPUTER LECTURE 02

Binary Decimal
Equivalent
000 0
001 1
010 2
011 3
100 4
101 5
110 6
111 7

## 2. OCTAL NUMBER SYSTEM

In the octal number system the base is 8. So in this system there are only
eight symbols or digits: 0,1,2,3,4,5,6 and 7 (8 and 9 do not exist in this
system) again each position in an octal number represents a power of the
base(8). The decimal equivalent of the octal number 2057 (written as 20578)
is as follows:

## (2x83) + (0x82) + (5x81) + (7x80)

=1024 + 0 + 40 + 7
= 1071

So we have 20578=107110
Observe that since there are only 8 digits in the octal number system, So 3
bits (23=8) are sufficient to represent any octal number in binary.

## 3. HEXADECIMAL NUMBER SYSTEM

The hexadecimal number system is one with base of 16. The base of 16
suggests choices of 16 single character digits as follows:
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
The symbols A, B,C,D,E,F representing the decimal values
10,11,12,13,14,15 respectively. Each position in a hexadecimal system
represents a power of the base (16) thus the decimal equivalent of the
hexadecimal number (1AF)16
(1 x 162 ) + (A x 161 ) + (F x 160)
=(1x 256) + (10x 16) + (15 x 1)
=256 + 160 + 15
=431

2
INTRODUCTION TO COMPUTER LECTURE 02

## Thus (1AF)16 =(431)10

CONVERTING FROM ONE NUMBER SYSTEM TO
ANOTHER

## There are many methods or techniques that can be used to convert

numbers from one base to another. We will see one technique used in
converting to base 10 from any other base and second technique to be
used in converting from base 10 to any other base.

## 1. Converting To Decimal From Another Base

The following three steps are used to convert to a base 10 value from any
other number system.
Step1. Determine the column (positional) value of each digit ( this
depends on the position of the digit and the base of the number
system)
Step2 Multiply the obtained column values (in Step1 ) by the digit in
corresponding columns.
Step3. Sum the products calculated in Step2. The total is the equivalent
value in decimal.

## Example1: 110012 = ?10

Solution:
Step1. Determine column value.

1 20=1
2 21=2
3 22=4
4 23=8
5 24=16

## Step2. Multiply column values by corresponding column digit.

16 8 4 2 1
x x x x x
1 1 0 0 1
__________________________
16 8 0 0 1

## Step3. Sum the product

16 + 8 + 0 + 0 + 1=25

3
INTRODUCTION TO COMPUTER LECTURE 02

Hence 110012=2510

Example 2. (4706)8=?10

## Solution: 4x8 + 7x8 + 0x8 + 6x8

=4x512 + 7x64 +0x8 + 6x1
=2048 + 448 + 0 + 6
=2502

Hence (4706)8=(2502)10

## Solution: (1AC)16=1x162 + 10x161 +12x160

=256 + 160 + 12
Hence =42810

Example 4. 40527=?10

## Solution: 4x73 + 0x72 + 5x71 + 2x70

=4x343 + 0x49 + 5x7 + 2x1
=1372 + 0 + 35 + 2
Hence =(1409)10

Example 5. (4052)6=?10

## Solution: 4x6 + 0x6 + 5x6 + 2x6

=4x216 + 0 + 5x6 + 2x1
=864 + 0 + 30 + 2
=89610
Hence (4052)6 =(896)10

## 2. Converting From Base 10 To A New Base

The following four steps are used to convert a number from base 10 to
another base.
Step1. Divide the decimal number to be converted by the value of the new
base.
Step2. Record the remainder from Step1 as the rightmost digit ( least
significant digit) of the new bas number.
Step3. Divide the quotient of the previous divide by the new base.

4
INTRODUCTION TO COMPUTER LECTURE 02

Step4. Record the remainder from Step3 as the next digit (to the left) of the
new base number.
Repeat Step3 and 4 recording remainders from right to left, until
the quotient becomes zero in Step3. Note that the last remainder
thus obtained will be the most significant digit(MSD) of the new
base number.
Example: 2510=?2

## Step 1&2: 25/2= 12 and remainder 1

Step 3&4: 12/2= 6 and remainder 0
Step 3&4: 6/2 = 3 and remainder 0
Step 3&4: 3/2 = 1 and remainder 1
Step 3&4: 1/2 = 0 and remainder 1

## As mentioned in step 2&4, the remainders have to be arranged in

the reverse order so that the first remainder becomes the least
significant (LSD) and the last remainder becomes the most
significant digit (MSD).
Hence (25)10 = (11001)2

Example 1. 4210 = ?2

2 42
2 21 0

2 10 1

2 5 0

2 2 1

1 0

## Example 2. (952)10 =?8

5
INTRODUCTION TO COMPUTER LECTURE 02

8 952
8 119 0

8 14 7

2 1 6

16 428

16 26 12

1 10

## 3. Converting From A Base Other Than 10 To A Base Other

Than 10
The following two steps are used to convert one number system to
another number system.
Step 1. Convert the original number to a decimal number (Base 10)
Step 2. Convert the decimal so obtained to the new base.
Example. (545)6 = ?4

## 5x6 + 4x6 + 5x6

= 5x36 + 4x6 + 5x1
=180 + 24 + 5
= (209)10
Step 2. Convert (209)10 to base 4

4 209

4 52 1
4 13 0

3 1

## Hence (545)6 = (3101)4

4. Shortcut Method For Binary To Octal Conversion
The following steps are used in this method.

6
INTRODUCTION TO COMPUTER LECTURE 02

Step 1. Divide the binary digits into groups of three (starting from
right).
Step 2. Convert each group of three binary digits into one octal digit
by using weight 1,2 and 4 from right side.
Example. (101110)2 = ?8
Step 1. divide the binary digits into groups of 3 starting from right
(LSD)
101 110

## Step 2. Convert each group into one digit of octal.

(101)2 = 1x22 + 0x21 + 1x20
=4 + 0 + 1
=58
(110)2 = 1x22 + 1x21 + 0x20
=4 + 2 + 0
=68
Hence (101110)2 = (56)8
5. Shortcut Method For Octal To Binary Conversion
The following steps are used in this method.
Step 1.Convert each octal digit to a 3 digit binary number.
Step 2.Combine all the resulting binary groups into a single binary
number.
Example. (562)8 = ?2

Solution.
Step 1. Convert each octal digit to 3 binary digits.
58 = 1012
68 = 1102
28 = 0102

## Step 2. Combine the binary groups.

Hence: 5628 = (101110010)2

## 6. Shortcut Method For Binary To Hexadecimal Conversion

The following steps are used in this method.

## Step 1. Divide the binary digits into groups of four.

Step 2. Convert each group of four binary digits to one hexadecimal
digit.

## Example. (11010011)2 = ?16

Solution.

7
INTRODUCTION TO COMPUTER LECTURE 02

## Step 2. 1101 0011

Convert each group of 4 binary digits to 1 hexadecimal digit.

## 11012 = 1x23 + 1x22 + 0x21 + 1x20

=8+4+0+1
= 1310
= D16
00112 = 0x23 + 0x22 + 1x21 + 1x20
=0+0+2+1
= 316
Hence (1010011)2 = D316

## Step 1. Convert the decimal equivalent of each hexadecimal digit to

4 binary digits.
Step 2. Combine all the resulting binary groups into a single binary
number.
Example. (2AB)16 = ?2

Solution.
Step 1. Convert the decimal equivalent of each hexadecimal digit to
4 binary digits.
216 = 210 = (0010)2
A16 = (10)10 = (1010)2
B16 = (11)10 = (1011)2
Step 2. Combine the binary groups.
2AB16 = (001010101011)2
8. Fractional Numbers
In a binary number system, fractional numbers are formed in the same
general way as in the decimal system.

and

## Similarly in binary system

8
INTRODUCTION TO COMPUTER LECTURE 02

## 0.101 = (1x2-1) + (0x2-2) + (1x2-3)

and
10.01 = (1x21) + (0x20) + (0x2-1) + (1x2-2)