Page 30 - ComputerScience_Class_11
P. 30
Example 2: (10111.11) + (1101.01) 2
2
Answer: +1 +1 +1 +1 +1 +1 +1
1 0 1 1 1 . 1 1
+ 1 1 0 1 . 0 1
1 0 0 1 0 1 . 0 0
(100101.00) 2
Example 3: (10011.11) + (1111) + (10.1) 2
2
2
Answer: +1 +1 +1 +1+1 +1 +1
1 0 0 1 1 . 1 1
1 1 1 1
+ 1 0 . 1
1 0 0 1 0 1 . 0 1
(100101.01) 2
1.3.2 Binary Subtraction
Binary subtraction can be done by three different methods which are as follows:
• Borrow method
• 1’s complement method
• 2’s complement method
Binary Subtraction by Borrow Method
The following cases may arise:
Bits Result Borrow
0 – 0 0 0
0 – 1 1 1 borrowed from adjacent left digits
1 – 0 1 0
1 – 1 0 0
Example 1: Subtract 101 from 1001. Both of these numbers are binary numbers.
Answer: -1
1 0 0 1
Borrow
- 1 0 1
1 0 0
(100) 2
Example 2: Subtract (11) from (10000) .
2
2
Answer: -1 -1 -1 -1
Borrow 1 0 0 0 0
1 1
(1101) 2 1 1 0 1
Binary Subtraction by 1’s Complement Method
In 1’s complement method, the complement value of a binary number is obtained by replacing 0 with 1 and 1 with 0.
For example, 1’s complement of 10011 is 01100.
28 Touchpad Computer Science (Ver. 3.0)-XI

