## How to convert between the binary and the decimal number system

A number system can be defined as the set of the different combinations of symbols, with each symbol having a specific weight. Any number system is differentiated on the basis of the radix or the base on which the number system is made. Radix or the Base defines the total no of different symbols, which is used in a particular number system. For example the radix of Binary number system is 2 and the radix of decimal number system is 10.

## Binary Number System: A definition

In this system we have two distinct digits for ease we consider these digits as 0 and 1. In computers we have devices like flip-flops which can be used to store any of the two level according to the control signal. Normally higher level is assigned the value 1 and lower level is assigned the value 0, hence forming a binary system.

## Conversion of Decimal to Binary:

Conversion of decimal number into binary number can be done by following steps:

- Divide the decimal number by 2 and note the remainder and assign a value R1 = remainder, similarly assign the value Q1 = quotient obtained in this division.
- Now divide Q1 with 2 and note the remainder. Assign the value of remainder to R2 and the value of quotient to Q1.
- Continue the sequence till at some point in division you get the value of quotient (Qn) equal to 0.
- The binary number will look something like: R(n) R(n-1) . . . . . . . . . . . . . . . . . . . . . R3 R2 R1

Example: Let us consider a binary number 179.

1.) | 179 / 2 = (89 * 2) + 1 | Q1 = 89 | R1 = 1 |

2.) | 89 / 2 = (44 * 2) + 1 | Q2 = 44 | R2 = 1 |

3.) | 44 / 2 = (22 * 2) + 0 | Q3 = 22 | R3 = 0 |

4.) | 22 / 2 = (11 * 2) + 0 | Q4 = 11 | R4 = 0 |

5.) | 11 / 2 = (5 * 2) + 1 | Q5 = 5 | R5 = 1 |

6.) | 5 / 2 = (2 * 2) + 1 | Q6 = 2 | R6 = 1 |

7.) | 2 / 2 = (1 * 2) + 0 | Q7 = 1 | R7 = 0 |

8.) | 1 / 2 = (0 * 2) + 1 | Q8 = 0 | R8 = 1 |

So the Binary equivalent of 179 is:

(179) DECIMAL = (10110011) BINARY

## Conversion from Binary into Decimal:

Conversion of a binary number to decimal number can be carried out by following steps:

- Write down the weight associated below every digit of binary number.
- Now note the weight for which the binary value is equal to 1.
- Add all the numbers obtained in previous step.
- The n0. Obtained in last step will be the decimal equivalent of the binary.

Example: Let us consider a binary value 1101001.

1.) First step:

R8 | R7 | R6 | R5 | R4 | R3 | R2 | R1 |

1 | 0 | 1 | 1 | 0 | 0 | 1 | 1 |

Binary | 1 | 1 | 0 | 1 | 0 | 1 | |

Weight associated | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

2.) Second step: Weights for which binary digits are 1.

64 | 32 | 8 | 1 |

3.) Third step: Adding all the weights.

105 = 64 + 32 + 8 + 1

4.) Last step: The Decimal equivalent of the Binary is:

(1101001) BINARY = (105) DECIMAL

## Importance of Binary System in Computing:

As we all know that a computer is an electronic device, more specifically a digital electronic device. The computer makes use of billions and billions of transistors which operate digitally. The term digital is concerned with the discrete logic levels. Logic levels are the different potential levels like 5V, 0V, 10v and many others. The computer while working makes use of two logic level s, so if we want to represent any number which is intelligible to computer, we must write the numbers with Radix equal to 2. The two symbols in this number system is analogous to the two discrete logic levels. For our ease we consider these two symbols as 0 and 1, but for a computer 0 and 1 are different voltage levels. Generally, 0 is considered for lower voltage level and 1 is considered for higher voltage level.

All we see on screen of the computer or provide the input through mouse or keyboard are all 0s and 1s, the only difference is their sequential arrangement. So, if we want to get our work done from the computer we must know how binary works and what is the relation of binary with decimals in order to convert the values from binary domain into our known domain.