Complement is also a mathematical operation.
The complement of a number is a tool used to subtract numbers when only addition is allowed. I will explain complements for our familiar decimal number system.
To find the complement of a number, you need to know how many digits you want your complement to have. Then, make the substitutions in the table below and then add 1 to the result.
The digit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
changes to | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
Example: Find the complement of 7520. We want 5 digits.
To subtract two numbers using complements, you take the first number and add it to the complement of the second number, then erase the "1" at the beginning of the sum.
Example: From 375 subtract 82.
wikipedia.org dumped 2003-03-17 with terodump