Page 30 - Touhpad Ai
P. 30

Converting Decimal to Binary
              To convert a decimal number (base 10) to a binary number (base 2), follow these steps:

              1.  Divide the decimal number by 2.
              2.  Write down the remainder (it will be 0 or 1).
              3.  Divide the quotient again by 2, and write down the next remainder.
              4.  Repeat the process until the quotient becomes 0.

              5.   The binary number is obtained by reading the remainders in reverse order (from the last remainder obtained to
                 the first).
              Example 1: Convert the decimal number 23 into binary number.

                                                           2   23    1
                                                           2   11    1
                                                           2   5     1
                                                           2   2     0
                                                               1

              Now read the remainders in reverse order:
              23  = 10111
                10      2
              Example 2: Convert the decimal number 17 into binary number.

                                                           2   17    1
                                                           2   8     0
                                                           2   4     0
                                                           2   2     0
                                                               1

              Now read the remainders in reverse order:
              17  = 10001 2
                10

              Converting Binary to Decimal
              To convert a binary number to a decimal number, follow these steps:
              1.  Write down the binary number.
              2.  Starting from the right, write the place values (powers of 2):
              3.  Multiply each binary digit by its place value.

              4.  Add all the results together. The sum is the decimal number.
              Example 1: Convert the binary number 1011 into decimal number.
                             1
                         2
                 = 1×2 +0×2 +1×2 +1×2 0
                     3
                 = 1×8+0×4+1×2+1×1
                 = 8+0+2+1
                 = 11
              So, 1011  =11 10
                     2
              Example 2: Convert the binary number 110101 into decimal number.
                     5
                 = 1×2 +1×2 +0×2 +1×2 +0×2 +1×2 0
                         4
                                 2
                                      1
                             3
                 = 1×32+1×16+0×8+1×4+0×2+1×1
                 28     Touchpad Artificial Intelligence - XI
   25   26   27   28   29   30   31   32   33   34   35