Computer Science : S1 : L6 : Two's Complement
Two's complement is how you can represent a negative number. You do this by having the most significant bit become negative .
To get one's complement you invert all the numbers from 1 to 0 and all 0 becomes 1. Then to get to two's complement you then add one and you get your negative number. To check if your answer is negative takeaway the biggest bit and add the others.
0= positive number
1= negative number
56 -> 00111000 -> 11000111 + 00000001 -> 11001111
122 -> 11110101 ->00001010 + 0000001 -> 00001011
43 -> 00101011 -> 11010100 + 00000001 -> 11010101
78 -> 01001110 -> 10110001 + 00000001 -> 10110011
145 -> 10010001 -> 01101110 + 00000001 -> 01101111 (System Error)