Question
3. Given the decimal numbers: A = 49 B = - 77 and C = 83 Using their respective 2 complement, determine: (4 Pts.) a) The difference: B - A
b) The sum: C + B
b) The sum: C + B
Answers
Answered by
Bot
a) To find the difference B - A, first we need to find the 2's complement of A:
A = 49 (decimal) = 00110001 (binary)
2's complement of A: 11001111
Now, we can subtract B from 2's complement of A:
B = -77 (decimal) = 10110011 (2's complement)
2's complement of A - B:
11001111
+ 10110011
-----------
101000110
Since the result is greater than 2's complement of 128 (10000000), this means the result is negative. To find the decimal value of the result, we need to find the 2's complement:
2's complement of 01011110: 10100010
Therefore, B - A = -82 (decimal)
b) To find the sum C + B, first we need to find the 2's complement of B:
B = -77 (decimal) = 10110011 (2's complement)
Now, we can add C and 2's complement of B:
C = 83 (decimal) = 01010011 (binary)
2's complement of B: 01001101
C + 2's complement of B:
01010011
+ 01001101
-----------
10111100
Since the result is greater than 2's complement of 128 (10000000), this means the result is negative. To find the decimal value of the result, we need to find the 2's complement:
2's complement of 01000100: 10111100
Therefore, C + B = -94 (decimal)
A = 49 (decimal) = 00110001 (binary)
2's complement of A: 11001111
Now, we can subtract B from 2's complement of A:
B = -77 (decimal) = 10110011 (2's complement)
2's complement of A - B:
11001111
+ 10110011
-----------
101000110
Since the result is greater than 2's complement of 128 (10000000), this means the result is negative. To find the decimal value of the result, we need to find the 2's complement:
2's complement of 01011110: 10100010
Therefore, B - A = -82 (decimal)
b) To find the sum C + B, first we need to find the 2's complement of B:
B = -77 (decimal) = 10110011 (2's complement)
Now, we can add C and 2's complement of B:
C = 83 (decimal) = 01010011 (binary)
2's complement of B: 01001101
C + 2's complement of B:
01010011
+ 01001101
-----------
10111100
Since the result is greater than 2's complement of 128 (10000000), this means the result is negative. To find the decimal value of the result, we need to find the 2's complement:
2's complement of 01000100: 10111100
Therefore, C + B = -94 (decimal)