1's Complement and 2's Complement

In general, we (human beings) express negative numbers by placing a minus (-) sign at the left end of the number. Similarly while representing the integers in binary format, we can leave the left-most bit be the sign bit. If the left-most bit is a zero, the integer is positive; if it is a one, it is negative.
 
1's complement ---reverse all the bits
2's complement ---reverse all the bits + 1

Examples
Original number: 0111011
1's complement: 1000100
2's complement: 1000101

Original number: 1111111
1's complement: 0000000
2's complement: 0000001

Original number: 1111000
1's complement: 0000111
2's complement: 0001000 

Post a Comment

1 Comments