BIT103 · 2081.2 · 5 marks
Perform A - B with the given binary numbers using 1’s complement. A = 1010100, B = 1000100.
Perform $A - B$ with the given binary numbers using 1’s complement. $A = 1010100$, $B = 1000100$. [5]
A − B Using 1's Complement Method
Given
- $A = 1010100$
- $B = 1000100$
- Operation: $A - B$ using 1's complement
Decimal check of inputs:
- $A = 1010100_2 = 64+16+4 = 84$
- $B = 1000100_2 = 64+4 = 68$
Solution
Step 1: 1's Complement of B
Invert every bit of $B$:
B = 1000100
1's comp = 0111011
Step 2: Add A and 1's complement of B
1010100
+ 0111011
---------
10001111
Bit-by-bit (right to left):
- $0+1 = 1$
- $0+1 = 1$
- $1+0 = 1$
- $0+1 = 1$
- $1+1 = 0$, carry 1
- $0+1+1 = 0$, carry 1
- $1+0+1 = 0$, carry 1 (carry out)
Result = $1,0001111$ (a carry out of 1 is generated).
Step 3: End-around carry
Since a carry is produced, the result is positive. Add the carry back to the 7-bit sum:
0001111
+ 1
---------
0010000
Step 4: Final Result
$$A - B = 0010000_2$$
Verification
$$0010000_2 = 16_{10}, \quad 84 - 68 = 16 \checkmark$$
Conclusion
$$A - B = 0010000_2 = 16_{10}$$
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.