3000. Add the following numbers in binary:
a. 7810 + 7810 using one’s complement
b. -AB16 + 708 using one’s complement
c. 4395 + 647 using two’s complement
3.a. 7810 + 7810 using one’s complement:
78 DIV 2 = 39 78 MOD 2 = 0 7810 = 10011102
39 DIV 2 = 19 39 MOD 2 = 1
19 DIV 2 = 9 19 MOD 2 = 1 Chk: = 26 + 23 + 22 + 21
9 DIV 2 = 4 9 MOD 2 = 1 = 64 + 8 + 4 + 2
4 DIV 2 = 2 4 MOD 2 = 0 = 78
2 DIV 2 = 1 2 MOD 2 = 0
1 DIV 1 = 0 1 MOD 2 = 1
Carry-over: 1 111 Chk: = 27 + 24 + 23 + 22
0,000000001001110 = 128 + 16 + 8 + 4
+ 0,000000001001110 = 156 = 78 + 78
0,000000010011100
3.b. -AB16 + 708 using one’s complement
AB16 = A B
1010 1011 = 0,000000010101011
Complementing: 1,111111101010100
708 = 7 0
111 000 = 0,000000000111000
Carry-Over: 111
+ 0,000000000111000
1,111111110001100
But Since the result is negative:
111111110001100 Complemented = 0000000011100112 = 11510
Which we know to be true since AB16 = 17110 and 708 = 5610 and
-17110 + 5610 = 11510
3.c. 4395 + 647 using two’s complement:
4395 = 4 * 52 + 3 * 51 + 9 * 50 647 = 6 * 71 + 4 * 70
= 4 * 25 + 3 * 5 + 9 * 1 = 6 * 7 + 4 * 1
= 100 + 15 + 9 = 42 + 4
= 12410 = 4610
1111100 101110
124 DIV 2 = 62 124 MOD 2 = 0 46 DIV 2 = 23 46 MOD 2 = 0
62 DIV 2 = 31 62 MOD 2 = 0 23 DIV 2 = 11 23 MOD 2 = 1
31 DIV 2 = 15 31 MOD 2 = 1 11 DIV 2 = 5 11 MOD 2 = 1
15 DIV 2 = 7 15 MOD 2 = 1 5 DIV 2 = 2 5 MOD 2 = 1
7 DIV 2 = 3 7 MOD 2 = 1 2 DIV 2 = 1 2 MOD 2 = 0
3 DIV 2 = 1 3 MOD 2 = 1 1 DIV 2 = 0 1 MOD 2 = 1
1 DIV 2 = 0 1 MOD 2 = 1
Adding: 1111100
+ 0101110
101010102 = 17010
Since we are not dealing with negative numbers, we do not need to complement