Answer:
00011101
00011101
Explanation:
Given the following arithmetic operations
a) (+42) + (-13)
b) (-42) - (-13)
From (a):
We need to convert +42 into binary, so we get = 00101010
Now for +13, when it is converted into binary, we get = 00001101
But, here, the 13 is negative. So, here is what we will do, we will have to take the two compliment of the binary. After doing that, we get = 111110011
∴
+ 42 → 00101010
<u> - 13 → 1 1 1 10011 </u>
<u>+29 000 11101 </u>
Thus, the arithmetic operation after we use 2's complement is 00011101
b)
Here both 42 and 13 are negative. Using two complement representation
-42 is first converted to binary as 00101010, Then → 11010101 + 1 = 11010110
-13 is converted to binary as 00001101 → 11110010 = 11110011
In between, a negative sign exists, so we take another 2's complement.
i.e.
11110011 → 00001100 + 1 = 00001101
- 42 → 1 1 01 0110
<u>+13 → 00001 101</u>
<u>-29 1 1 1 00011</u>
<u />
since there is no carry, we take two's complements for the result as:
1 1 1 00011 →00011100 + 1 = 00011101