## Addition and Subtraction using 1's complementIn our previous section, we learned about different complements such as 1's complement, 2's complement, 9's complement, and 10's complement, etc.. In this section, we will learn to perform the arithmetic operations such as addition and subtraction using 1's complement. We can perform addition and subtraction using 1's, 2's, 9's, and 10's complement. ## Addition using 1's complementThere are three different cases possible when we add two binary numbers which are as follows:
Initially, calculate the 1's complement of the given negative number. Sum up with the given positive number. If we get the end-around carry 1, it gets added to the LSB.
- First, find the 1's complement of the negative number 1001. So, for finding 1's complement, change all 0 to 1 and all 1 to 0. The 1's complement of the number 1001 is 0110.
- Now, add both the numbers, i.e., 1101 and 0110;
1101+0110=1 0011 - By adding both numbers, we get the end-around carry 1. We add this end around carry to the LSB of 0011.
0011+1=0100
Initially, calculate the 1's complement of the negative value. Sum it with a positive number. In this case, we did not get the end-around carry. So, take the 1's complement of the result to get the final result. ## Note: The resultant is a negative value.
- First find the 1's complement of the negative number 1110. So, for finding 1's complement, we change all 0 to 1, and all 1 to 0. 1's complement of the number 1110 is 0001.
- Now, add both the numbers, i.e., 1101 and 0001;
1101+0001= 1110 - Now, find the 1's complement of the result 1110 that is the final result. So, the 1's complement of the result 1110 is 0001, and we add a negative sign before the number so that we can identify that it is a negative number.
In this case, first find the 1's complement of both the negative numbers, and then we add both these complement numbers. In this case, we always get the end-around carry, which get added to the LSB, and for getting the final result, we take the 1's complement of the result. ## Note: The resultant is a negative value.
- Firstly find the 1's complement of the negative numbers 01101 and 01110. So, for finding 1's complement, we change all 0 to 1, and all 1 to 0. 1's complement of the number 01110 is 10001, and 01101 is 10010.
- Now, we add both the complement numbers, i.e., 10001 and 10010;
10001+10010= 1 00011 - By adding both numbers, we get the end-around carry 1. We add this end-around carry to the LSB of 00011.
00011+1=00100 - Now, find the 1's complement of the result 00100 that is the final answer. So, the 1's complement of the result 00100 is 110111, and add a negative sign before the number so that we can identify that it is a negative number.
## Subtraction using 1's complementThese are the following steps to subtract two binary numbers using 1's complement - In the first step, find the 1's complement of the subtrahend.
- Next, add the complement number with the minuend.
- If got a carry, add the carry to its LSB. Else take 1's complement of the result which will be negative
## Note: The subtrahend value always get subtracted from minuend.
We take 1's complement of subtrahend 00111, which comes out 11000. Now, sum them. So, 10101+11000 =1 01101. In the above result, we get the carry bit 1, so add this to the LSB of a given result, i.e., 01101+1=01110, which is the answer.
We take 1's complement of subtrahend 10111, which comes out 01000. Now, add both of the numbers. So, 10101+01000 =11101. In the above result, we didn't get the carry bit. So calculate the 1's complement of the result, i.e., 00010, which is the negative number and the final answer. |

For Videos Join Our Youtube Channel: Join Now