Subtract 13(10) from 35(10) using 2’s complement method.
Answers
Answer:
(i) At first, 2’s complement of the subtrahend is found.
(ii) Then it is added to the minuend.
(iii) If the final carry over of the sum is 1, it is dropped and the result is positive.
(iv) If there is no carry over, the two’s complement of the sum will be the result and it is negative.
Concept:
When subtracting two numbers in binary, add the second number's (2's complement + 1) to the first number. The binary addition of a negative value is binary subtraction.
Given:
Given numbers are and .
Find:
Subtract from using 2’s complement method.
Solution:
Let A be and B be .
Binary representation of
Binary representation of
Steps to find B-A:
Step 1: Find 1's complement of A. 1's complement is obtained by inverting all of its binary digits, i.e. replacing 1s with 0s and 0s with 1s.
1's complement of A
Step 2: 2’s complement of A = (1’s complement of A + 1)
2’s complement of A
2’s complement of A .
Step 3: Now, for , add this 2’s complement of A to B.
Ignore the leftmost overflow carry bit (1 in this case).
Hence the result is .