Adding Binary Numbers
Binary numbers are added the same way as decimal numbers.
The basic rule to remmber is this:
- 0 + 0 = 0
- 1 + 0 = 1
- 1 + 1 = 0 (and carry 1)
As we said before, decimal numbers are based on a deca-system whereas binary number follow a dual system.
Here is an example of a decimal number additon: suppose we want to add then number 342 to the number 471;
we all know how it's done but let's break it down to investigate:
- First we add the rightmost digits, and carry forward any digits to the next block
342
+ 471
-------
= 813
- so we added 2 + 1 = 3 then, 4 + 7 = 11 -- write down the digit 1 and carry 1 to the next block (which in fact is the next decade),
- now we add 4 + 3 + 1 and carry over = 8
- write down the final addition as 813 from left to rght
Now let's look at a binary number addition:
Let's say you want to add (010)2 = (2)10 to (110)2 = (6)10
The answer shoud be (8)10 which in binary is equivalent to the digits 1000
Let's see:
010
+ 110
------------
1000
This is how it works, step-by-step:
- Starting form the leftmost digit, just like in the decimal system, we add 0 + 0 = 0
- write down 0
- next we add 1+ 1 = 0, write down 0 and carry 1 over t the next binary
- 0 + 1 = 1 + 1 we carried over from before = 0, and carry over 1
- write down 0, carry over and write down 1
The answer written from the leftmost digit is 1000
(1000)2 = (8)10