a. 1101 + (-1001)
To perform the addition using two's complement, we first need to convert the numbers to their respective two's complement representation.
1101 is positive, so its two's complement representation remains the same: 1101.
To find the two's complement representation of -1001, we first take the one's complement of the number by flipping all the bits: 0110. Then we add 1 to the one's complement: 0111. So, -1001 in two's complement representation is 0111.
Now, we can add the two numbers:
1101
+ 0111
---------
10100
Since the leftmost bit is a 1, it indicates that the result is negative. To find the magnitude of the negative value, we take the two's complement of the result: 0100. Therefore, 1101 + (-1001) equals -0100.
b. (-1101) + (-1110)
To perform the addition using two's complement, we first need to convert the numbers to their respective two's complement representation.
To find the two's complement representation of -1101, we first take the one's complement of the number by flipping all the bits: 0010. Then we add 1 to the one's complement: 0011. So, -1101 in two's complement representation is 0011.
To find the two's complement representation of -1110, we first take the one's complement of the number by flipping all the bits: 0001. Then we add 1 to the one's complement: 0010. So, -1110 in two's complement representation is 0010.
Now, we can add the two numbers:
0011
+ 0010
---------
0101
Since the leftmost bit is a 0, it indicates that the result is positive. Therefore, (-1101) + (-1110) equals 0101.
c. 8 - 9
To perform the subtraction using two's complement, we can convert the numbers to their respective two's complement representation.
The decimal number 8 is equivalent to the binary value 1000. In two's complement, positive numbers remain the same, so the two's complement representation of 8 is 1000.
To find the two's complement of 9, we first take the one's complement of the number by flipping all the bits: 1000. Then we add 1 to the one's complement: 1001. So, the two's complement representation of 9 is 1001.
Now, we can subtract the two numbers:
1000
- 1001
-------
1111
Since the leftmost bit is a 1, it indicates that the result is negative. To find the magnitude of the negative value, we take the two's complement of the result: 0001. Therefore, 8 - 9 equals -0001 or simply -1.
d. -4 - 8
To perform the subtraction using two's complement, we can convert the numbers to their respective two's complement representation.
To find the two's complement representation of -4, we first take the one's complement of the number by flipping all the bits: 0011. Then we add 1 to the one's complement: 0100. So, the two's complement representation of -4 is 0100.
To find the two's complement of 8, we first take the one's complement of the number by flipping all the bits: 0111. Then we add 1 to the one's complement: 1000. So, the two's complement representation of 8 is 1000.
Now, we can subtract the two numbers:
0100
- 1000
-------
1100
Since the leftmost bit is a 1, it indicates that the result is negative. To find the magnitude of the negative value, we take the two's complement of the result: 0100. Therefore, -4 - 8 equals -0100 or simply -4.
Solve the following using the two's complement
a.1101+(-1001)
b.(-1101)+(-1110)
c.8-9
d.-4-8
1 answer