Because A-B=A+ (-B), the subtraction of signed numbers can be accomplished by adding the complement. Subtract each of the following pairs of 5-bit binary numbers by adding the complement of the subtrahend to the minuend. Indicate when an overflow occurs. Assume that negative number are represented in 1’s complement. Then repeat using 2’s complement.

a) 01001-11010b) 11010-11001c) 10110-01101d) 11011-00111e) 11100-10101

Respuesta :

Answer:

Using 1's complement

a)

Therefore the difference is -10001

b)

Therefore the difference is 00001

c)

Therefore the difference is 01001

d)  

Therefore the difference is 10100

e)

Therefore the difference is 00111

Explanation:

Using 1's complement

a) The 1's complement of the subtrahend 11010 = 00101.

Therefore 01001-11010 = 01001 + 00101 = 01110

Since no overflow, we take the 1's complement of the result and it is negative.

Therefore the difference is -10001

b) The 1's complement of the subtrahend 11001 = 00110.

Therefore 11010-11001 = 11010 + 00110 =1 00000

Since there is an overflow, we add the overflow to the result

Therefore the difference is 00001

c) The 1's complement of the subtrahend 01101 = 10010

Therefore 10110-01101 = 10110 + 10010 =  1 01000

Since there is an overflow, we add the overflow to the result

Therefore the difference is 01001

d)  The 1's complement of the subtrahend 00111 = 11000

Therefore 11011-00111= 11011 + 11000 =  1 10011

Since there is an overflow, we add the overflow to the result

Therefore the difference is 10100

e) The 1's complement of the subtrahend 10101 = 01010

Therefore 11100-10101= 11100 + 01010 = 1 00110

Since there is an overflow, we add the overflow to the result

Therefore the difference is 00111

Using 2's complement

a) The 2's complement of the subtrahend 11010 = 00110.

Therefore 01001-11010 = 01001 + 00110 = 01111

Since no overflow, we take the 2's complement of the result and it is negative.

Therefore the difference is -10001

b) The 2's complement of the subtrahend 11001 = 00111.

Therefore 11010-11001 = 11010 + 00111 =1 00001

Since there is an overflow, we drop the overflow

Therefore the difference is 00001

c) The 1's complement of the subtrahend 01101 = 10011

Therefore 10110-01101 = 10110 + 10011 =  1 01001

Since there is an overflow, we drop the overflow

Therefore the difference is 01001

d)  The 1's complement of the subtrahend 00111 = 11001

Therefore 11011-00111= 11011 + 11001 =  1 10100

Since there is an overflow, we drop the overflow

Therefore the difference is 10100

e) The 1's complement of the subtrahend 10101 = 01011

Therefore 11100-10101= 11100 + 01011 = 1 00111

Since there is an overflow, we drop the overflow

Therefore the difference is 00111