Page 10 - Code & Click - 7
P. 10
BINARY ADDITION
The basic rules for binary addition are listed in the table below:
Case Input Sum Carry
1 0 + 0 0 0
2 0 + 1 1 0
3 1 + 0 1 0
4 1 + 1 0 *1
*Carry of 1 is shifted to the next column to the left of the current digit.
Example 1 Example 2 Example 3
Compute (101) + (100) Compute (1011) + (1101) Compute (11111) + (1001)
2 2 2 2 2 2
1 1 1 Carry 1 1 1 1 Carry
1 0 1 1 0 1 1 1 1 1 1 1
+ 1 0 0 + 1 1 0 1 + 1 0 0 1
1 0 0 1 1 1 0 0 0 1 0 1 0 0 0
BINARY SUBTRACTION
The basic rules for binary subtraction are listed in the table below:
Case Input Sum Carry
1 0 – 0 0 0
2 1 – 0 1 0
3 1 – 1 0 0
4 0 – 1 1 *1
* To subtract a higher digit from a lower digit, i.e., 1 from 0, one has to borrow from the left column.
Example 1 Example 2 Example 3
Compute (1110) + (101) 2 Compute (10101) + (1010) 2 Compute (11101) + (10011) 2
2
2
2
0 10 0 10 0 10 0 10
1 1 1 0 1 0 1 0 1 1 1 1 0 1
– 1 0 1 – 1 0 1 1 – 1 0 0 1 1
1 0 0 1 1 0 1 1 0 1 0 1 0
BINARY MULTIPLICATION
The Binary multiplication is similar to the decimal multiplication. It is simpler than decimal multiplication
because only 0 and 1 are involved. The basic rules for binary multiplication are listed in the table below:
8