Page 41 - Computer Science Class 11 With Functions
P. 41

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
                                  0
                  2
                          1
                = 2 × 17 + 2 × 1 + 2 × 0
                  2

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

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

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

                                                             0
                = 2 × (2 × 1 + 0) + 2 × 0 +2 × 0 + 2 × 1 + 2 × 1 + 2 × 0
                                      3
                         5
                                                    1
                                             2
                  6
                                                           0
                                4
                = 2 × 1 +2 × 0 + 2 × 0 +2 × 0 +2 × 1 + 2 × 1 + 2 × 0
            Thus, we have expressed 70 in terms of a sum of the powers of 2:
                              4
                                                  1
                        5
                 6
            70 = 2 × 1 +2 × 0 +2 × 0 +2 × 0 +2 × 1 + 2 × 1 + 2 × 0
                                                         0
                                           2
                                     3
            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)
                10           2
                    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
                                  2                                                     10
            number (1000110)  as a decimal number, we must get the original number (70)  shown below:
                             2                                                    10
                    Find decimal equivalents of 1001, 1100, and 110.
                                                                            Number Systems and Encoding Schemes  39
   36   37   38   39   40   41   42   43   44   45   46