186k views
0 votes
For each of the following pairs of signed integers (2’s complement), subtract the second from the first. Show the decimal equivalents of each operand and the difference, Indicate overflow where appropriate

a) 111010 001111
b) 000100 011000
c) 010001 011010
d) 010000 100100

1 Answer

5 votes

Answer:

The answers are

a)111010 - 001111 = 101011 = 43

b) 000100 - 011000 = 111111111 (overflow) = -20

c) 010001 - 011010 = 11111111 (overflow) = -9

d) 010000 - 100100 = 1111111 (overflow) = -20

Explanation:

a)111010 = 1×2⁵+1×2⁴+1×2³+0×2²+1×2¹+0×2⁰ = 32+16+8+0+2+0= 58

001111 = 0×2⁵+0×2⁴+1×2³+1×2²+1×2¹+1×2⁰ = 8+4+2+1=15

111010 - 001111 = 101011 = 43

b) 000100 = 0×2⁵+0×2⁴+0×2³+1×2²+0×2¹+0×2⁰ = 4

011000 = 0×2⁵+1×2⁴+1×2³+0×2²+0×2¹+0×2⁰ = 24

000100 - 011000 = 1111111111 (overflow), 4 - 24 =-20

c) 010001 = 1×2⁴+1×2⁰ = 17

011010 = 1×2⁴+1×2³+1×2¹ = 26

010001 - 011010 = 11111111 (overflow) 17-26=-9

d) 010000 = 1×2⁴ = 16

100100 = 1×2⁵+1×2² = 36

010000 - 100100 = 1111111 (overflow) 16-36=-20

User Kowsky
by
4.1k points