## How to convert a decimal to binary code

The computer transforms the information entered from the keyboard in a binary system. The example below shows the method of converting decimal to binary.

1- To convert a decimal to binary, you must divide this number by the base 2. If the quotient resulting from division is not zero, divide by 2 and repeat with all non-zero quotients, and this, until the last division operation (1/2) which gives a probability zero.

Example of division with the vertical method:

Decimal The base = 9 = 2

9 | _2

1 | 4 | _2

0 | 2 | _2

0 | 1 | 2 _

1 | 0

Dividing 1 by 2 gives a quotient zero, which implies the end of division

Hence the binary value of the decimal number “9″ is: 1001.

2- The notion of concatenation is used to present the result of conversion “Decimal – Binary”. Two examples of concatenation:

A) spaced numbers: 1 2 3 4

After concatenation: 1234.

B) Numbers ordered vertically:

0

A

A

- After the horizontal concatenation of binary numbers above, we obtain the value: 110.

3- To find the binary value of a decimal number, we proceed to the concatenation of all remnants of the division number and quotients of non-zero by the base 2, and are ordered in reverse order of operation vertical division (see the example in step 01), that is to say, from bottom to top and from left to right.

Example:

Division base number = quotient and remainder

121/60 = 1 2

60/30 2 = 0

30/15 2 = 0

15/2 = 1 7

7/3 = 1 2

3/2 = 1 1

1/2 = 0 1 (null quotient thus, end the division).

The binary value of decimal 121 is: 1111001