Page 36 - ComputerScience_Class_11
P. 36
2. Find the 7’s complement of the subtrahend.
3. Add this result to the minuend.
4. Add the leftmost carry (MSB) to the rightmost digit (LSB) to get the answer (when minuend > subtrahend).
5. Convert the result to its 7’s complement and place 1 as sign bit in MSB or a -ve sign in answer (when minuend <
subtrahend).
Example 1: (3216) - (765) 8 +1 +1
8
Answer: 3216 has 4 digits and 765 has 3 digits. 3 2 1 6
So, adding 0 it becomes 0765 + 7 0 1 2
7’s complement of 0765 is 7012 1 2 2 3 0
1
Adding 3216 and 7012, we get 12230 2 2 3 1
(2231) 8
Example 2: (362.4) - (76.7) 8 +1
8
Answer: 76.7 has 3 digits and 362.4 has 3 digits in the integer part 3 6 2 . 4
So, 7’s complement of 076.7 is 701.0 + 7 0 1 . 0
Adding 362.4 and 701.0, we get 1263.4 1 2 6 3 . 4
1
(263.5) 8 2 6 3 . 5
Example 3: (665) - (3216) 8
8
Answer: 7’s complement of 3216 is 4561. +1 +1
Adding 665 and 4561, we get 5446 + 4 6 6 5
6
5
1
7’s complement of 5446 is 2331.
5 4 4 6
(-2331) 8
Example 4: (234.34) - (565.67) 8
8
Answer: 7’s complement of 565.67 is 212.10 2 3 4 . 3 4
Adding 234.34 and 212.10, we get 446.44 + 2 1 2 . 1 0
7’s complement of 446.44 is 331.33. 4 4 6 . 4 4
(-331.33) 8
Octal Subtraction by 8’s complement method
8’s complement of a number is obtained by adding 1 to 7’s complement. For example, the 7’s complement of 26501 is
51276. Its 8’s complement is 51276 + 1 = 51277
The steps to be followed are:
1. Make the number of digits in 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 8’s complement of the subtrahend.
3. Add this result to the minuend.
4. Discard the leftmost carry (MSB) to get the answer (when minuend > subtrahend).
5. Find 8’s complement of the sum and assign 1 as sign bit in MSB or -ve sign as answer (when minuend <
subtrahend).
34 Touchpad Computer Science (Ver. 3.0)-XI

