# Perform the arithmetic operation (+42)+(-13) and (-42)-(-13) in binary using the signed -2’s-complement representation for negative numbers.

(i) Solution:

42 = 101010

13 = 001101

For 13,

1’s complement = 110010

2’s complement = 110010 + 1 = 110011

∴ -13 = 110011 (using signed -2’s complement representation)

So, (+42) + (-13) =

    1 0 1 0 1 0
+   1 1 0 0 1 1
----------------
1 0 1 1 1 0 1

First 1 is discarded so,

(+42) + (-13) = = 011101

(ii) Solution:

42 = 0101010

1’s complement = 1010101

2’s complement = 1010110

So, -42 = 1010110 (using signed 2’s complement representation)

-13 = 1110011

So, (-42) – (-13) =

  1 0 1 0 1 1 0
- 1 1 1 0 0 1 1
------------
1 1 0 0 0 1 1
So, (-42) - (-13) = 1100011