To add +13 and -9 using two's complement:
1. Convert both numbers to binary representation:
+13 = 00001101
-9 = 11110111
2. In two's complement, we can add numbers as usual, including the sign bit.
00001101 (+13)
+ 11110111 (-9)
_______________
= 000001100
^
|
|
Overflow
3. Since the result consists of 9 bits, and we are only using 8 bits, it overflows and we ignore the leftmost bit.
= 00001100
Therefore, +13 + (-9) = +12 in two's complement.
Add +13 and -9 using two's complement
1 answer