Complements are
used in the digital computers in order to simplify the subtraction operation
and for the logical manipulations.
1's complement
The 1's complement of a number is found by changing all 1's to 0's
and all 0's to 1's. This is called as taking complement or 1's complement.
Example of 1's Complement is as follows:
1011001 à 0100110
10000 à 01111
11011 à 00100
2's complement
The 2's complement of binary number is obtained by adding 1 to the
Least Significant Bit (LSB) of 1's complement of the number.
2's complement = 1's complement + 1
Example of 2's Complement is as follows:
0101 à 1010 + 1 = 1011
101100 à 010011 + 1 = 010100
0000 à 1111 + 1 = 10000
111 à 000 + 1 = 001
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.