
- Write down the binary number: Make sure it has a fixed number of bits (e.g., 8 bits).
- Invert the digits: Change every 0 to 1 and every 1 to 0. This is known as taking the one’s complement of the number.
- Add one to the result: This final step gives you the two’s complement of the original binary number.
Example
Let’s find the two’s complement of the 8-bit binary number 00101100.
- Write down the binary number:
00101100
- Invert the digits (one’s complement):
11010011
- Add one to the inverted number:
11010011 + 1 = 11010100
So, the two’s complement of 00101100 is 11010100.
Explanation
- Original binary number:
00101100 - One’s complement:
11010011(inverted digits) - Add 1: When you add 1 to
11010011, you get11010100.
This result (11010100) is the two’s complement of the original binary number 00101100.