Conversion of Number Bases JSS2 Computer Studies Lesson Note

Download Lesson Note
Lesson Notes

Topic: Conversion of Number Bases

 CONVERSION OF NUMBER BASES

DECIMAL AND BINARY

Conversion of decimal to binary 

To convert decimal to binary divide decimal number by 2 till you get to zero (0)

 

Example 1: Convert 3710  to binary

Solution 

Division  Quotient  Reminder
372 18 1
182 9 0
92 4 1
42 2 0
22 1 0
12 0 1

          3710 =   1001012

 

Example 2: Convert 9310  to binary

Solution 

Division  Quotient  Reminder
932 46 1
462 23 0
232 11 1
112 5 1
52 2 1
  22 1 0
12 0 1

9310  = 10111012

 

Example 3:  Convert 25.62510  into a binary number

SOLUTION 

Division  Quotient  Reminder
252 12 1
122 6 0
62 3 0
32 1 1
12 0 1

 

2510  = 110012

Fractional part

0.62510 = 0.1012

Therefore = 25.62510 = 11001.1012

 

Conversion of binary to decimal

It is required to find the decimal value of each binary digit position containing a 1 and add them up. 

Example 1 Convert binary (10110)2 into a decimal number. 

Solution. The binary number given is 1 0 1 1 02 

Positional weights     4 3 2 1 0  

1 × 24 + 0 × 23+ 1 × 22 + 1 × 21 + 0 × 20 

= 16 + 0 + 4 + 2 + 0 = (22)10.

Example 2: Convert binary 110112 to a decimal number

Solution: Binary number given is:   1 1 0 1 12

Position weights             4 3 2 1 0

1 x 24 + 1 x 23 + 0 x22  + 1 x 21 + 1 x20

16+ 8 + 0+ 2+ 1 = 2710 

 

Example 3: Convert 1010.0112 into a decimal number. 

Solution. The binary number given is 1 0 1 0. 0 1 12 

Positional weights     3 2 1 0 -1-2-3 

1 × 23 + 0 × 22 + 1 × 21 + 0 × 20 + 0 × 2-1 + 1 × 2-2 + 1 × 2-3

= 8 + 0 + 2 + 0 + 0 + 0.25 + 0.125 

1010.0112  = (10.375)10.

DECIMAL NUMBER AND OCTAL NUMBER

Conversion of Decimal number to octal number

Repeatedly divide by eight and record the remainder for each division – read “answer” upwards. 

Example 1: Rewrite the decimal number 21510  as an octal number. 

Solution

 

Division  Quotient  Reminder
2158 26 7
268 3 2
38 0 3

          21510 = 3278

 

Example 2: Convert decimal 179210 to an octal number  

Solution 

Division  Quotient  Reminder
17928 224 0
2248 28 0
288 3 4
38 0 3

          179210 = 34008

 

Conversion of octal to decimal

The conversion can also be performed in the conventional mathematical way, by showing each digit place as an increasing power of 8.

Example 1: Convert 3458 to decimal number 

Solution 

The octal number given is = 345

Position weights 210

3458 = 3 x 82 + 4 x 81 + 5 x  80   

= (3 x 64) + (4 x 8 + (5 x 1) 

= 192 + 32 +5 = 22910

 

Example 2: Convert 34628  into a decimal number. 

Solution. The octal number given is 3 4 6 28

Positional weights     3 2 1 0 

3 × 83 + 4 × 82 + 6 × 81 + 2 × 80 

= 1536 + 256 + 48 + 2= (1842)10

= (1842)10.

 

Example 3: Convert 362.358 into a decimal number. 

Solution. The octal number given is 3 6 2. 3 5 

Positional weights     2 1 0 -1-2 

3 × 82 + 6 × 81 + 2 × 80 + 3 × 8-1 + 5 × 8-2

= 192 + 48 + 2 + 0.375 + 0.078125 

= (242.453125)10.

DECIMAL AND HEXADECIMAL

Conversion of Decimal Number to Hexadecimal Number 

To convert the decimal number to hexadecimal, divide the decimal number by 16.

Example 1: Convert 179210  decimal to hexadecimal:

Solution 

Division  Quotient  Reminder
179216 112 0
11216 7 0
716 0 7

179210 = 70016

 

 

Conversion of Hexadecimal-to-decimal

Example 1: Convert 42AD16  into a decimal number. 

Solution. The hexadecimal number given is 4 2 A D 

Positional weights     3 2 1 0  

4 × 163 + 2 × 162 + 10 × 161 + 13 × 160 

= 16384 + 512 + 160 + 13 

= (17069)10

Example 2:  Convert 42A.1216 into a decimal number. 

Solution. The hexadecimal number given is 4 2 A. 1 2 

Positional weights       2 1 0 -1-2 

4 × 162+ 2 × 161 + 10 × 160 + 1 × 16-1 + 1 × 16-2 

= 1024 + 32 + 10 + 0.0625 + 0.00390625 

= (1066.06640625)10.

 

Conversion of Decimal Number to Hexadecimal Number.

Example: Rewrite the decimal number 21510 as an octal number. 

16   215 

16    13   R=7 

16    0     R =1310  = D 

Therefore: 21510  = D716 

Computers store information in the form of “1” and “0”s in different types of storage such as memory, hard disk, USB drives, etc. The most common digital data storage unit is byte which is 8 bits.

For your information, computer data is expressed as bytes, kilobytes, and megabytes as it is in the metric system, but 1 kilobyte is 1024 bytes, not 1000 bytes.

Data storage units are bit, byte, kilobyte (kb), megabyte (MB), gigabyte (GB), terabyte (TB), and petabyte.

A ‘bit’ (short for Binary Digit) is the smallest unit of data that can be stored by a computer. Each ‘bit’ is represented as a binary number, either 1 (true) or 0 (false).

Lesson Notes for Other Classes