In: Computer Science
Subtract in binary
Hello student,
Steps for Binary Subtraction are:
1: Start from the column of Least significant bit.
2: Subtract vertically like in usual subtraction process, following the rules of binary subtraction.
3: Only if needed, borrow from the next column.
Rules for Binary Subtraction
X |
- Subtract |
Y |
Result |
Borrow |
0 |
- |
0 |
0 |
0 |
0 |
- |
1 |
1 |
1 |
1 |
- |
0 |
1 |
0 |
1 |
- |
1 |
0 |
0 |
Example-
Let us subtract 12 (1100) and 6 (0110)
Here ( ) symbol means carrying
1. (Rules of binary subtraction)
In third column from the Lsb after borrowing 1, that place becomes 0. Same with the 4th column too.
We get answer as 0110 which is 6.
Subtracting 12 and 6 in decimal form also gives 6.
Thus correct.
---------------------------------------------------------------------------------------------------------------------------------------------------------
THANK YOU!
LIKE THE ANSWER IF IT HELPED
FOR ANY QUERY ASK IN THE COMMENTS