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

Example 4: (4C.7)  - (92D.8) 16
                                16
                 Answer: 15’s complement of 92D.8 is 6D2.7.                     +1
                                                                                       4     C   .   7
                 Adding 4C.7 and 6D2.7, we get
                                                                           +     6     D     2   .   7
                 15’s complement of 71E.E is 8E1.1.                              7     1     E   .   E
                 (-8E1.1) 16


                 Hexadecimal Subtraction by 16’s Complement Method
                 16’s complement of a number is obtained by adding 1 to 15’s complement. For example, the 15’s complement of A2B3
                 is 5D4C. Its 16’s complement is 5D4C + 1 = 5D4D

                 The steps to be followed are:
                 1.  Make the number of digits of the subtrahend equal to minuend by adding leading 0’s in the integer part of the
                   subtrahend and trailing 0’s in the decimal part if required.
                 2.  Find the 16’s complement of the subtrahend.
                 3.  Add this answer to the minuend.
                 4.  Discard the left most carry (MSB) to get the answer (when minuend > subtrahend).
                 5.  Find 16’s complement of the sum and assign 1 as sign bit in MSB or -ve sign as answer (when minuend < subtrahend).

                 Example 1: (2E6F)  - (B78) 16
                                 16
                 Answer: Represent subtrahend as 0B78 to make it 4 digit number.  +1  +1         +1
                                                                                      2     E    6     F
                 15’s complement of 0B78 is F487.
                                                                                 +    F     4    8     8
                 16’s complement of F487 is F488.                                1    2     2    F     7

                 Adding 2E6F and F488, we get 122F7
                 Removing leftmost 1, we get 22F7.
                 (22F7)
                      16

                 Example 2: (4BC)  - (16A5) 16                                              +1    +1
                                16
                 Answer: 15’s complement of 16A5 is E95A.                                   4      B    C

                 16’s complement of E95A is E95B.                                +    E     9      5    B
                                                                                      E     E      1    7
                 Adding 4BC and E95B, we get EE17.

                 15’s complement of EE17 is 11E8.
                 16’s complement of 11E8 is 11E9.
                 (-11E9) 16


                 Example 3: (179.E)  - (C8.F) 16
                                 16
                 Answer: 15’s complement of 0C8.F is F37.0                     +1          +1
                                                                                     1     7     9    .   E
                 16’s complement of F37.0 is F37.1
                                                                                +    F     3     7    .   1
                 Adding 179.E and F37.1, we get 10B0.F
                                                                                1    0     B     0    .   F
                 Discarding 1 in MSB, we get 0B0.F

                 (-B0.F) 16





                                                                                                                        35
                                                                                                            Numbers     35
   32   33   34   35   36   37   38   39   40   41   42