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

To understand why the above method works, let us examine the following computations:
                  (1DC)
                       16
                              1
                      2
                                        0
                  = 16 × 1 + 16 × (13) + 16 × (12)
                                                                                      0
                       2
                                                                 3
                               1
                                    3
                                                                               1
                                                         0
                  = (16) × 1 + 16 × (2 × 1 + 2 × 1 + 2 × 0 + 2 × 1) + (2 × 1 + 2 × 1 + 2 × 0 + 2 × 0)
                                           2
                                                                        2
                                                  1
                                                                      2
                     4 2
                                         2
                                                1
                                                       0
                                                               3
                             4
                                  3
                                                                             1
                                                                                    0
                  = (2 ) × 1 +2 × (2 × 1 + 2 × 1 + 2 × 0 + 2 × 1) + (2 × 1 + 2 × 1 + 2 × 0 + 2 × 0)
                                                              4
                                                                                              0
                  = (2 )  × 1 + 2 × 2 × 1 +2 × 2 × 1 + 2 × 2 × 0 + 2 × 2 × 1 + 2 × 1 + 2 × 1 + 2 × 0 + 2 × 0
                                            2
                              4
                                                   4
                                  3
                     4 2
                                        4
                                                                                2
                                                                         3
                                                                  0
                                                                                       1
                                                       1
                                          5
                                                               2
                                   6
                                                        3
                                                                      1
                     8
                                                                             0
                            7
                                                 4
                  = 2 × 1 + 2 × 1 + 2 × 1 + 2 × 0 + 2 × 1 + 2 × 1 + 2 × 1 + 2 × 0 + 2 × 0
              Thus, (1DC) = (111011100)
                        16              2
                       Find binary representation of (34) , (6D) and (12F) .
                                                  16    16       16
              Octal to Hexadecimal Conversion
              To convert an octal number to hexadecimal or vice versa, convert the number to an equivalent number in binary or
              decimal and then to hexadecimal.
              Example 11: Convert (347)  to its equivalent hexadecimal number.
                                      8
              Step 1: Octal to Binary
                     3         4          7
                     ↓         ↓         ↓
                    011       100       111
                  (347)  = (11100111)
                       8            2
              Step 2: Binary to hexadecimal
                   1   1   1   0  0   1   1   1
                       E           7
                  (11100111)  = (E7) 16
                            2
                  Therefore (347)  = (E7) 16
                                8
              Alternatively,  you  may  first  convert  the  octal  number  to  its  decimal  equivalent  and  then  find  the  hexadecimal
              representation of the decimal number.
                       Find hexadecimal representation of (34) , (15) and (50) .
                                                       8    8      8
              Hexadecimal to Octal Conversion
              First, convert the hexadecimal number to an equivalent binary number and then convert the binary number to an octal
              number, as shown in example 12.
              Example 12: Convert (E7)  to its equivalent octal number.
                                     16
              Step 1: Hexadecimal to Binary
                     E         7
                     ↓         ↓
                   1110      0111
              Binary equivalent of (E7)  is (11100111) 2
                                    16
                36   Touchpad Computer Science (Ver. 2.0)-XI
   45   46   47   48   49   50   51   52   53   54   55