4 Use a 2s complement and b 1s complement arithmetic to perf
4. Use (a) 2s complement and (b) 1s complement arithmetic to perform the following operations:
1) 1011010 – 10101
2) 10101 - 1011010
Please show work! I am trying to understand.
Solution
1s complement.
1) 1011010 - 10101
solution:
A :1011010
B: 10101
We want to find A-B.
So lets find, 1s complement of B, which is : 01010
Now A + B= 1011010 + 01010 = 1100100.
2) A : 10101,B : 1011010
1s complement of B is 0100101
So, A+B will be : 0111010
---------------------
2s complement:
1) To find 2s complement of a binary digit, we first find 1s complement and then add 1 to it.
for, 1011010, 2s complement will be : 0100101 + 1 = 0100110
for,10101 : 01010 + 1 = 01011
so, A - B = 0000000
2) 2s complement for 10101 .e., 0010101 is 1101010 +1 = 1101011and for 1011010 is 0100110
So, 1101010 - 0100110 = 1000000

