Subject: Computer Science

It consists of :

- conversion from binary to decimalnumber system
- conversion from binary to octal number system
- conversion from binary to hexadecimal number system

**Conversion of binary to decimal (base 2 to base 10):**

The rules for conversion from binary to decimal are given below:

- Multiply each bit by corresponding power of 2 (base).
- Sum each product term to get a decimal equivalent number.

Note: A power of 2 is 0 for a left bit of binary point (or for a right most bit for the number that does not contain fractional part) and increase the power by one for each bit towards left and decrease power by one towards the right of binary point.

**Example 1: convert (110011) _{2} to decimal.**

Solution:

(110011)_{2 }= 1×2^{5} + 1×2^{4} + 0×2^{3} + 0×2^{2} + 1×2^{1} + 1×2^{0}

= 32 + 16 + 0 + 0 + 2 +1

= (51)_{10}

**Example 2: convert (1011.101) _{2} into decimal.**

(1011.101)_{2 }= 1×2^{3} + 0×2^{2} + 1×2^{1} + 1×2^{0} + 1×2^{-1} + 0×2^{-2} + 1×2^{-3}

= 8 + 0 + 2 + 1 +0.5+ 0 +0.125

= 11 + 0.5 + 0.125

= (11.625)_{10}

The rules for conversion from binary to decimal are given below:

- Divide the given binary number into a group of three bits from binary point to left (or from right to left if no fractional part) and from binary point to the right. Append 0’s at leading or trailing or trailing position if necessary to make each group of 3 bits.
- Substitute each group of three bits by octal equivalent from a table.
- Collect octal digits to get an octal equivalent number.

**Example: convert (10110101) _{2 }into octal.**

Solution:

Dividing the given binary number (10110101)_{2} into groups of 3 bits from right to left, and appending 0’s at leading position, we have,

The rules for conversion from binary to hexadecimal are as given below:

- Divide the given binary number into a group of four bits from binary point to left (or from right to left if no fractional part) and from binary point to the right. Append 0’s at leading or trailing position if necessary to make each group of 4 bits.
- Substitute each group of four bits by hexadecimal equivalent symbol (letter or digit) from the table.
- Collect Hexadecimal symbols to get Hexadecimal equivalent number

**Example: convert (10101011101) _{2} into hexadecimal**

Solution:

Dividing the given binary number (10101011101)_{2} into groups of 4 bits from binary point to left and binary point right and appending 0’s at leading or at trailing position to make each group of four bits, we have,

It consists of conversion from decimal to binary, octal and hexadecimal number system which are described below:

The rules for conversion from decimal to binary are as given below:

- Divide the given number by 2 and note the remainder.
- Repeatedly divide the quotient by two and note the remainder until quotient reduced to 0.
- Collect the remainders, last obtained first and first obtained last to binary equivalent.

**Example: convert (51) _{10 }into binary**

Solution:

51÷2=25 | remainder | = 1 |

25÷ 2=12 | remainder | = 1 |

12÷ 2=6 | remainder | = 0 |

6÷ 2=3 | remainder | = 0 |

3÷ 2=1 | remainder | = 1 |

1÷ 2=0 | remainder | = 1 |

Therefore, (51)_{10 }= (110011)_{2}

The rules for conversion from decimal to binary are as given below:

- Divide the given number by 8 and note the remainder.
- Repeatedly divide the quotient by 8 and note the remainder until quotient reduced to 0.
- Collect the remainders, last obtained first and first obtained last to get the octal equivalent.

**Example: convert (177) _{10} into octal**

Solution:

177÷ 8 =22 | remainder | = 1 |

22÷ 8 = 2 | remainder | = 6 |

2÷ 8 = 0 | remainder | = 2 |

Therefore, (177)_{10} = (261)_{8}

**Conversion of decimal to hexadecimal (base 10 to base 16):**

**Example: convert (77) _{10 }into hexadecimal**

Solution:

77÷ 16=4 | remainder | = 13 which means D |

4÷ 16 =0 | remainder | = 4 |

Therefore, (77)_{10 }= (4D)_{16}

It consists of conversion from octal to decimal, binary and hexadecimal number system which are described below:

**Conversion of octal to decimal (base 8 to base 10):**

Multiply the each octal digit by corresponding power of 8 and sum each product term to get decimal equivalent.

**Example: convert (632) _{8} to decimal.**

Solution:

(632)_{8} = 6×8^{2} + 3×8^{1} + 2×8^{0}

= 384 + 24 + 2

= 410

Therefore, (632)_{8} = (410)_{10}

**Conversion from octal to binary (base 8 to base 2):**

Substitute each octal digit by equivalent 3 bit binary from table and collect bits for each digit to get binary equivalent numbers.

Example: convert (741)_{8} into binary.

**Conversion from octal to hexadecimal (base 8 to base 16):**

Actually, there is no direct method for converting from octal to hexadecimal so first, convert octal into binary or decimal and then convert binary or decimal to hexadecimal.

It consists of conversion from hexadecimal to decimal, binary and octal number system which are described below:

**Conversion of hexadecimal to decimal (base 16 to base 10):**

The rules for conversion from hexadecimal to decimal are as given below:

- Multiply each digit by corresponding power of 16(base) as in decimal to binary.
- Sum each product term to get decimal equivalent.

**Example: convert (F4C) _{16} into decimal.**

Solution:

(F4C)_{16 }= F×16^{2} + 4×16^{1} + C×16^{0}

= 15×256 + 4×16 + 12×1

= 3840 + 64 + 12

= 3916

Therefore, (F4C)_{16 }= (3916)_{10}

**Conversion of hexadecimal to binary (base 16 to base 2):**

Substitute each hexadecimal symbol by equivalent 4 bit binary from table and collect bits for each digit to get binary equivalent numbers.

**Conversion of hexadecimal to octal (base 16 to base 8):**

There is no direct method for converting from hexadecimal to octal, so first convert hexadecimal into binary or decimal and then convert binary or decimal to octal.

(Dilli , 2015,218-222)

**Bibliography**

Dilli , S. P., Singh, k. E., Khadka , D., Bhatta, K. D., Baral, N., Saud, R. S., . . . Dangi, R. (2015). *Fundamental of Computer Science.* Kathmandu: KEC publication and Distribution.

Gurung,Juddha Bahadur et.al.,Computer Science-XI,Bhundipuran Prakashan,Ktm

- Conversion of binary to decimal(base 2 to base 10)
- Conversion of binary to octal (base 2 to base 8)
- Conversion of binary to hexadecimal (base 2 to base 16)
- Conversion of decimal to binary (base 10 to base 2)
- Conversion of decimal to octal (base 10 to base 8)
- Conversion of decimal to hexadecimal (base 10 to base 16)
- Conversion of octal to decimal(base 8 to base 10)
- Conversion of octal to binary(base 8 to base 2)
- Conversion of octal to hexadecimal(base 8 to base 16)
- Conversion of hexadecimal to binary(base 16 to base 2)
- Conversion of hexadecimal to octal (base 16 to base 8)

- It includes every relationship which established among the people.
- There can be more than one community in a society. Community smaller than society.
- It is a network of social relationships which cannot see or touched.
- common interests and common objectives are not necessary for society.

© 2019-20 Kullabs. All Rights Reserved.