Page 36 - computer science (868) class 11
P. 36

Example 2: (17A.62)  - (B3.D) 16
                                16
              Answer:                +16             +16
                              1   0   7     A  9  .   6      2
                          -         B (11)   3   . D (13)
                                      C      6        9      2

              (C6.92) 16

              Hexadecimal Subtraction by 15’s Complement Method
              15’s complement of a number is obtained by subtracting all bits from 15. For example, the 15’s complement of A5B2  is:

                                                           15    15     15    15
                                                     -     A      5     B      2
                                                           5      A     4      D
              The steps to be followed are:

              1.  Make the number of digits the subtrahend equal to minuend by adding leading 0’s in the integer part of the
                 subtrahend and trailing 0’s in the fractional part if required.
              2.  Find the 15’s complement of the subtrahend.
              3.  Add this answer to the minuend.
              4.  From the final result, add the left most carry (MSB) with the right most digit (LSB) to get the answer (when minuend
                 > subtrahend).
              5.  Convert the result to its 15’s complement and place 1 as a sign bit in MSB or add a -ve sign in answer (when minuend
                 < subtrahend).
              Example 1: (6A7F)  - (F63) 16
                               16
              Answer: 6A7F and F63 have 4 and 3 digits.                 +1           +1     +1
                                                                               6      A      7     F
              Adding leading 0 to subtrahend, we get 0F63.              +    F (15)   0      9     C
              15’s complement of 0F63 is F09C.                          1      5      B      1     B
                                                                                                   1
              Adding 6A7F and F09C, we get
                                                                               5      B      1     C
              (5B1C) 16


              Example 2: (8AB.57)  - (B7.8)                            +1          +1          +1
                                16       16
              Answer:  15’s complement of  0B7.80 is F48.7F                  8     A    B   .  5    7
                                                                        +    F     4    8   .  7    F
              Adding 8AB.57 and F48.7F  we get                          1    7     F    3   .  D    6

              (7F3.D7)                                                                              1
                      16
                                                                             7     F    3   .  D    7
              Example 3: (F62)  - (4A83) 16
                             16
              Answer: 15’s complement of 4A83 is B57C.
                                                                              +1
              Adding F62 and B57C, we get C4DE.                                      F     6     2
              15’s complement of C4DE is 3B21.                            +    B     5     7     C

              Add -ve sign, we get                                             C     4     D     E
              (-3B21) 16





                3434  Touchpad Computer Science-XI
   31   32   33   34   35   36   37   38   39   40   41