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

Example 1: (4517)  - (260) 8                               +1     +1
                              8
              Answer: 7’s complement of 0260 is 7517                            4     5      1     7
              8’s complement of 7517 is 7520                              +     7     5      2     0

              Adding 4517 and 7520, we get                                1     4     2      3     7
                                                                        Discarding MSB 1, we get 4237
              (4237)
                    8

              Example 2: (757.76)  - (51.77) 8                          +1    +1   +1
                                8
              Answer: 7’s complement of 051.77 is 726.00                      7     5    7  .  7     6
              8’s complement of 726.00 is 726.01                         +    7     2    6  .  0     1

              Adding 757.76 and 726.01, we get                           1    7     0    5  .  7     7
              (705.77) 8                                               Dropping leftmost 1, we get 705.77


              Example 3: (360)  - (4567) 8                                             3     6    0
                             8
              Answer: 7’s complement of 4567 is 3210.                      +     3     2     1    1
              8’s complement of 3210 is 3211                                     3     5     7    1
              Adding 360 and 3211, we get                                 7’s complement is 4206
                                                                          8’s complement is 4207
              (-4207) 8


              Example 4: (55.22)  - (457.76) 8                                      5    5   .  2   2
                               8
              Answer: 7’s complement of 457.76 is 320.01                  +    3    2    0   .  0   2
                                                                               3    7    5     2    4
              8’s complement of 320.01 is 320.02                         7’s complement is 402.53

              Adding 55.22 and 320.02, we get                            8’s complement is 402.54
              (-402.54) 8


                  1.5 HEXADECIMAL ARITHMETIC
              Like  other  number  systems,  the  arithmetic of hexadecimal numbers involves  hexadecimal addition,  hexadecimal
              subtraction, hexadecimal multiplication, and hexadecimal division. Hexadecimal arithmetic operations start from the
              rightmost least significant bit.

              1.5.1 Hexadecimal Addition
              Hexadecimal addition can be done by following steps:

              1.  Sum of the digits of the addends are calculated starting from the rightmost digit to the leftmost.
              2.  If the sum is less than 16, write the hexadecimal value as the result in that column.
              3.  If the sum exceeds 15, then subtract 16 from the result. The difference is taken as sum and 1 is carried to the next
                 more significant column.


                     Note: Alternatively, hexadecimal addition can be done using hexadecimal addition table. Add row value
                     with column value. The intersection cell is the sum. If the result is 2-digit, then the right digit is taken as
                     sum and left digit 1 is carry to the adjacent left digit.







                3232  Touchpad Computer Science-XI
   29   30   31   32   33   34   35   36   37   38   39