Assume you are performing 2s complement arithmetic in a comp
Assume you are performing 2\'s complement arithmetic in a computer with 8-bit registers. After the following code is run. signed char a = 125, b = 93, c; c = a + b; the binary value of C would be 11011010 and the chemical value of C would be -38 when printed out. Assume you are performing 2\'s complement arithmetic in a computer with 8-bit registers. After the following code is run. signed char a = 124, b = 99, c; c = a + b; the binary value of C would be 11011111 and the chemical value of C would be -33 when printed out.
Solution
18. a = 125, b = 93;
c = a + b = 125 + 93 = 218. But this is only 8 bit value, so the value is: -38.
And the binary value of 38 is: 00100110, and as this is a negative number, the 2\'s complement is: 1101 1010.
19. a = 124, b = 99;
c = a + b = 124 + 99 = 223. But this is only 8 bit value, so the value is: -33.
And the binary value of 33 is: 00100001, and as this is a negative number, the 2\'s complement is: 1101 1111.
