Page 45 - Computer Science V2.0 Class 11
P. 45

Given two non-negative numbers n and m (m ≠ 0), using the division algorithm, we can write n = m.q + r, where
                 0<=r<m, for a suitable choice of q and r. Thus, q is the quotient obtained by dividing n by m, and r is the remainder.
                 Now, let us rewrite the above computations using the division algorithm, which reveals more clearly why the above
                 method of converting a number from base 10 to base 2 works.
                    70

                    = 2 × 35 + 0
                               0
                    = 2 × 35 + 2 × 0

                                      0
                    = 2 × (2 × 17 + 1) + 2 × 0
                    = 2 × 17 + 2 × 1 + 2 × 0
                       2
                                      0
                               1
                                            0
                                      1
                       2
                    = 2 × (2 × 8 + 1) + 2 × 1 +2 × 0

                       3
                    = 2 × 8 + 2 × 1 + 2 × 1 + 2 × 0
                              2
                                     1
                                            0

                                                    0
                                             1
                                      2
                       3
                    = 2 × (2 × 4 + 0) + 2 × 1 + 2 × 1 + 2 × 0
                       4
                                            1
                                                   0
                              3
                                     2
                    = 2 × 4 +2 × 0 + 2 × 1 + 2 × 1 + 2 × 0
                                                   1
                                                          0
                                     3
                                            2

                       4
                    = 2 × (2 × 2 +0) + 2 × 0 +2 × 1 + 2 × 1 + 2 × 0
                                            2
                                                   1
                              4
                                                          0
                                     3
                    = 2 × 2 + 2 × 0 + 2 × 0 + 2 × 1 + 2 × 1 + 2 × 0
                       5
                                      4
                                                   2
                                                          1
                                            3
                    = 2 × (2 × 1 + 0) + 2 × 0 +2 × 0 + 2 × 1 + 2 × 1 + 2 × 0
                       5

                                                                 0
                                                  2
                                                                0
                                           3
                    = 2 × 1 +2 × 0 + 2 × 0 +2 × 0 +2 × 1 + 2 × 1 + 2 × 0
                              5
                                                         1
                       6
                                     4
                 Thus, we have expressed 70 in terms of a sum of the powers of 2:
                                                2
                                          3
                                   4
                                                       1
                             5
                                                              0
                      6
                 70 = 2 × 1 +2 × 0 +2 × 0 +2 × 0 +2 × 1 + 2 × 1 + 2 × 0
                 So, we can write binary representation of 70, as a sequence of coefficients of powers of 2 (beginning the coefficient of
                 the highest power of 2) in the above sum as follows:
                 (70 )  = (1000110) 2
                     10
                         Find binary equivalents of 5, 8, 16.
                 Binary to Decimal Conversion
                 Let us convert a binary number to decimal. For this, we use the place values with a base value of 2. The conversion
                 process involves the following steps:
                 1.  Write the binary number
                 2.  Below each digit, write the place value of the digit, represented as a power of 2.
                 3.  Multiply the face value of each digit with its place value.
                 4.  Add all values obtained in step 3 to get the decimal number.
                 In example 1, (1000110)  is the binary representation of the decimal number (70) . So, if we express the binary
                                                                                            10
                                       2
                 number (1000110)  as a decimal number, we must get the original number (70)  shown below:
                                                                                       10
                                 2
                         Find decimal equivalents of 1001, 1100, and 110.
                                                                                 Number Systems and Encoding Schemes  31
   40   41   42   43   44   45   46   47   48   49   50