# 9's and 10's Complement

If the number is binary, then we use 1's complement and 2's complement. But in case, when the number is a decimal number, we will use the 9's and 10's complement. The 10's complement is obtained from the 9's complement of the number, and we can also find the 9's and 10's complement using the r's and (r-1)'s complement formula.

## 9's Complement

The 9's complement is used to find the subtraction of the decimal numbers. The 9's complement of a number is calculated by subtracting each digit of the number by 9. For example, suppose we have a number 1423, and we want to find the 9's complement of the number. For this, we subtract each digit of the number 1423 by 9. So, the 9's complement of the number 1423 is 9999-1423= 8576.

### Subtraction using 9's complement

With the help of the 9's complement, the process of subtraction is done in a much easier way. Generally, we subtract the subtrahend from the minuend, but in a case when we perform subtraction using 9's complement, there is no need to do the same.

For subtracting two numbers using 9's complement, we first have to find the 9's complement of the subtrahend and then we will add this complement value with the minuend. There are two possible cases when we subtract the numbers using 9's complement.

Case 1: When the subtrahend is smaller than the minuend.

For subtracting the smaller number from the larger number using 9's complement, we will find the 9's complement of the subtrahend, and then we will add this complement value with the minuend. By adding both these values, the result will come in the formation of carry. At last, we will add this carry to the result obtained previously. Case 2: When the subtrahend is greater than the minuend.

In this case, when we add the complement value and the minuend, the result will not come in the formation of carry. This indicates that the number is negative, and for finding the final result, we need to find the 9's complement of the result. ## 10's Complement

The 10's complement is also used to find the subtraction of the decimal numbers. The 10's complement of a number is calculated by subtracting each digit by 9 and then adding 1 to the result. Simply, by adding 1 to its 9's complement we can get its 10's complement value. For example, suppose we have a number 1423, and we want to find the 10's complement of the number. For this, we find the 9's complement of the number 1423 that is 9999-1423= 8576, and now we will add 1 to the result. So the 10's complement of the number 1423 is 8576+1=8577.

### Subtraction using 10's complement

For subtracting two numbers using 10's complement, we first have to find the 10's complement of the subtrahend, and then we will add this complement value with the minuend. There are two possible cases when we subtract the numbers using 10's complement.

Case 1: When the subtrahend is smaller than the minuend.

For subtracting the smaller number from the larger number using 10's complement, we will find the 10's complement of the subtrahend and then we will add this complement value with the minuend. By adding both these values, the result will come in the formation of carry. We ignore this carry and the remaining digits will be the answer. Case 2: When the subtrahend is greater than the minuend.

In this case, when we add the complement value and the minuend, the result will not come in the formation of carry. This indicates that the number is negative and for finding the final result, we need to find the 10's complement of the result obtained by adding complement value of subtrahend and minuend.    