Binary Addition and Subtraction of 125 and 200
Step 1: Convert Decimal Numbers to Binary
- 125 in decimal = 1111101 in binary
- 200 in decimal = 11001000 in binary
For clarity, we will use 8-bit binary numbers (adding leading zeros where needed):
- 125 = 01111101
- 200 = 11001000
Step 2: Binary Addition (125 + 200)
01111101 (125)
+ 11001000 (200)
--------------
101100101
Explanation of addition:
- Add bit by bit from right to left, carrying over when sum exceeds 1.
- Result is 9 bits, so the final sum is:
101100101
This is a 9-bit number; the decimal equivalent is:
- 101100101₂ = (1×2^8) + (0×2^7) + (1×2^6) + (1×2^5) + (0×2^4) + (0×2^3) + (1×2^2) + (0×2^1) + (1×2^0)
= 256 + 0 + 64 + 32 + 0 + 0 + 4 + 0 + 1 = 357
Step 3: Binary Subtraction (125 – 200)
Since 125 – 200 is negative, subtraction must be handled using 2’s complement method.
(a) Find 2’s complement of 200
- 200 = 11001000
- Step 1: Find 1’s complement (invert bits): 00110111
- Step 2: Add 1: 00110111 + 1 = 00111000
(b) Add 125 and 2’s complement of 200
01111101 (125)
+ 00111000 (2's complement of 200)
--------------
10110101
- Result = 10110101 (8 bits)
Since there is no carry out beyond 8 bits, this result is negative in 2’s complement form.
(c) Find magnitude of result (take 2’s complement of 10110101)
- 1’s complement of 10110101 = 01001010
- Add 1: 01001010 + 1 = 01001011
(d) Convert 01001011 to decimal:
= (0×2^7) + (1×2^6) + (0×2^5) + (0×2^4) + (1×2^3) + (0×2^2) + (1×2^1) + (1×2^0)
= 0 + 64 + 0 + 0 + 8 + 0 + 2 + 1 = 75