Complements are used in the digital computers in order to simplify the subtraction operation and for logical manipulations.
The two types of complements are 1’ complement and 2’ complement.
*1. 1’ complement:**
The 1 ’ complement of a number is found by changing all 1’ to 0’ and all 0’ to 1’. This is called as taking complement or 1’ complement. For example, 10101 is 01010 in 1’* complement.
*2. 2’ complement:**
The 2’ complement of binary number is obtained by adding 1 to the Least Significant Bit (LSB) of 1 ’ complement of the number. 2’ complement = 1’ complement + 1
For example, 10101(2) 1’ complement is 01010 and 01010 + 1 = 01011 is 2’ complement.