Page 27 - CodePilot V5.0 C7
P. 27

The given examples will help you understand the conversion.
                 Example 1: Convert (125)  to a decimal          Example 2: Convert (5AD)  to a decimal number.
                                                                                             16
                                           16
                 number.                                             A = 10 (since A represents 10 in hexadecimal)
                                        1
                          = 1 × 16  +2 × 16  + 5 × 16 0              D = 13 (since D represents 13 in hexadecimal)
                                2
                                                                              2
                                                                                       1
                          = 1 × 256 + 2 × 16 + 5 × 1                   = 5 × 16  + 10 × 16  + 13 × 16 0
                          = 256 + 32 + 5                               = 5 × 256 + 10 × 16 + 13 × 1
                          = 293                                        = 1280 + 160 + 13
                                                                       = 1453
                 Therefore, (125)  = (293) 10                      Therefore, (5AD)  = (1453)
                                 16
                 DECIMAL TO BINARY NUMBER SYSTEM                                  16        10

                 To convert a decimal number to binary, follow these steps:

                 Step   1     Divide the given decimal number by 2 and note the remainder.
                 Step   2     Divide the quotient obtained from the previous step by 2 and note the new remainder.

                 Step  3      Repeat the steps until the quotient becomes less than 2.

                 Step   4     Write the remainders in reverse order, starting with the last remainder.

                 Example 1: Convert (13)  to a binary number.         Example 2: Convert (28)  to a binary number.
                                          10
                                                                                               10
                             2  13                                                2  28
                             2    6    1                                          2  14     0

                             2    3    0                                          2    7    0
                                  1    1                                          2    3    1
                                                                                       1    1
                 Therefore, (13)  = (1101) 2
                               10
                                                                      Therefore, (28)  = (11100) 2
                                                                                     10
                 DECIMAL TO OCTAL NUMBER SYSTEM

                 To convert a decimal number to octal, follow these steps:
                 Step   1     Divide the given decimal number by 8 and note the remainder.

                 Step   2     Divide the quotient obtained from the previous step by 8 and note the new remainder.

                 Step  3      Repeat the steps until the quotient  becomes less than 8.

                 Step   4     Write the remainders in reverse order, starting with the last remainder.

                 Example 1: Convert (1023)  to an octal number. Example 2:  Convert (4320)  to an octal number.
                                                                                                10
                                            10
                 8  1023                                            8  4320
                 8     127    1                                     8  540       0
                 8      15    0                                     8     67     4

                         1    1                                     8      8     3
                                                                            1    0

                 Therefore, (1023)  = (1777) 8
                                  10
                                                                    Therefore, (4320)  = (10340)  8
                                                                                      10

                                                                                                                  25
                                                                                                  Number System
   22   23   24   25   26   27   28   29   30   31   32