Computer Science JSS2

Week 7

Topic: CONVERSION OF NUMBER BASE SYSTEM

 DECIMAL TO BINARY CONVERSION

To convert a decimal number to its binary equivalent, follow these five steps

Step 1 The decimal number is divided by 2 (base of binary number)

Step 2 The reminder is written in the one place

Step 3 the result is again divided by two

Step 4 its reminder is written in the next place to the left

The process is repeated until the number becomes zero

Example, to convert the decimal n

OPERATION REMIANDER
118÷ 2 = 59 0
59 ÷ 2 = 29 1
29 ÷ 2 = 14 1
14 ÷ 2 = 7 0
7 ÷ 2 = 3 1
3 ÷ 2 = 1 1
1 ÷ 2 = 1 1

Number 118 to its binary equivalent.

Writing the sequence of reminders from the button up given the binary number 11101102

BINARY TO DECIMAL CONVERSION

To convert a binary to decimal equivalent, follow the given steps

Step 1: Multiply each of the binary number with 2 to the power of 0, 1, 2, 3 e.t.c

Step 2: All the products of multiplication are added to get the decimal equivalent of the number

Example, to convert the binary number 11011 = 1 x 25 + 1 x 24 + 0 x 23 + 1 x 21 + 1 x 20

                                                                                = 32 + 16 + 0 + 4 + 1

                                                                                = 55

The decimal value of 110/11 is 55

DECIMAL TO OCTAL CONVERSION

To convert a decimal number into its octal equivalent, the same procedure is adopted as in the decimal to binary conversion, but here the decimal number is divided by the number 8

Example, to convert the decimal number 1510 to its octal equivalent.

8 15                     REMAINDER
8 1                                7
  0                                1

The octal equivalent of 15 is 17

OCTAL TO DECIMAL CONVERSION

To convert an octal number to its decimal equivalent, the same procedures is used a in the binary to decimal conversion, but here the octal number is expressed as the sum of power of 8

Example, 568 = (6 x 81) + (5 x 80) = (6 x 8) + (5 x 1) = 5310

Therefore, the decimal value of 658 will be 53

OCTAL TO BINARY CONVERSION

To convert an octal number into its binary equivalent, each octal digit of the number is converted into its 3 bit binary equivalent.

For example, binary 000 is equivalent to octal digit 0, 111 is equivalent octal 7 and so on

Example (1574)8 = (00110111100)2. The binary equivalent of 1572 is 001101111100

BINARY TO OCTAL CONVERSION

To convert a binary into its octal equivalent, see the following example:

Example  1011002 = 1011002 grouped = 548

HEXADECIMAL TO DECIMAL CONVERSION

To convert hexadecimal number into its decimal equivalent, the same procedure is used as in the binary into decimal conversion, but here the number is expressed as the sum of power 16.

If you are doing this conversion orally, it is easier to start backward because counting the number of digit takes extra time, you might count wrongly.

If you do not remember what particular value of a power 16 is, it is easier to calculate it from the previous power value. For instance, if you do not remember what the value of 163 is, then just multiply the value of 162 (which you are likely to already have, if you start backward)16.

Example (5FA8)16  = (24488)10

              The decimal equivalent of 5FA8 is 24488

             5FA8 = 8 x 160 + A x 161 + F x 162 + 5 x 163

                      = 8 x 1 + 10 x 16 + 15 x 256 + 5 x 4096

                      = 8 + 160 + 3840 + 20480

                       = 24488

Therefore, the decimal value of 5FA8 is 24488

DECIMAL TO HEXADECIMAL CONVERSION

To convert decimal to hexadecimal, follow the stops below

Step 1: divide the decimal number by 16; treat the division as an integer division

Step 2: write down thee remainder (in hexadecimal)

Step 3: divide the result by 16, treat the division as an integer division

Step 4: repeat step 2 and 3 until the result is 0

Step 5: the hexadecimal value is the digit sequence of remainder from the last to the first.

16 256                            REMAINDER     
16 16                                           0
16 1                                             0
  0                                             1

 

 

N.B A remainder in this topic refers to the left over value after performing an integer division

Example to convert the number decimal 256 to hexadecimal

For more class notes, visit: https://passnownow.com/classwork-support/