If 1 is added to 1's complement of a binary number, the resulting number is known as the

*two's complement*of the binary number. For example, 2's complement of 0101 is 1011. Since 0101 represents (+5)10, therefore, 1011 represents (-5)10 in 2's complement representation. In this representation also, if the MSB is 0 the number is positive, whereas if the MSB is 1 the number is negative.

__Exercise__**Find the 2's complement of the numbers**

**01001110**

*Solution:*

0 1 0 0 1 1 1 0................Number

1 0 1 1 0 0 0 1................1's complement

__1__................Add 1

1 0 1 1 0 0 1 0

From the above example, we observe the following:

- If the LSB of the number is 1, its 2's complement is obtained by changing each 0 to 1 and 1 to 0 except the least-significant bit.
- If the LSB of the number is 0, its 2's complement is obtained by scanning the number from LSB to MSB bit by bit and retaining the bits as they are up to and including the occurrence of the first 1 and complement all other bits.