Decimal to Binary Conversion, C Programming Assignment Help

Assignment Help: >> Number Systems >> Decimal to Binary Conversion, C Programming

Decimal to Binary Conversion 

An easy method of converting a decimal number into a binary number is by dividing the decimal number by 2 progressively, until the quotient of zero is obtained. The binary number is obtained by taking the remainder after each division in the reverse order. This method is popularly known as the double-dabble method. The procedure for decimal to binary conversion is as follows:

Step 1: To take integer part and fractional part separately from the given decimal number.

Step 2: For Integer conversion: Divide the integer part of decimal number by 2 and take its remainder until the quotient becomes zero and reading the remainder from bottom to top gives the binary equivalent of the integer part.

Step 3: For fractional Conversion: If the decimal number is a fraction, its binary equivalent is obtained by multiplying the number continuously by 2, recording a carry in the integer position each time. The carries in the forward order give the required binary number.

Step 4: Combine the binary of integer and fractional part gives the binary of the given number.

Ex-1 Convert the decimal number 53.625 into an equivalent binary number.

Solution

Step 1 Take integer is 53. The fraction is 0.625.

Step 2 Integer conversions:

Dividend/divisor             Quotient             Remainder

53/2                                       26                           1

26/2                                       13                           0

13/2                                       6                             1

6/2                                         3                             0

3/2                                         1                             1

1/2                                          0                             1

Binary equivalent of (53)10= (110101)2.

Step 3 Fractional conversion: If the decimal number is a fraction, its binary equivalent is obtained by multiplying the number continuously by 2, recording a carry in the integer position each time. The carries in the forward order give the required binary number.

Multiplication                                                                    remainder                                                                          

0.625 x 2                               =             1.25                        1

0.250 x 2                               =             0.50                        0

0.500 x 2                               =             1.00                        1

0.000 x 2                               =             0.00                        0

Further multiplication by two is not possible since the product is zero. The binary equivalent is obtained by reading the carry terms from top to bottom. Thus, (0.625)10 is (0.101)2. The combined number will give the binary equivalent as (53.625)10 = (110101.101)2.   

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd