You add binary exactly the same you add decimal, just do it in binary. That may sound a bit cryptic, but it's true. What do you when you want to add two decimal numbers? Say you have 79+45. You start with the lowest digits, add them and get 14, put a 4 in the 1s place, carry a 1, add 7+4+1, you get 12, put a 2 in the 10s place, carry a 1 and put it in the 100s place, you get 124. You just add each pair of digits and carry. Didn't you learn this stuff in elementary school? You know how to add numbers in base ten, you know you know how, and I know you know how. Now, with binary, you do exactly the same thing. Of course, you have to do it more for a number of the same size, because there are more digits. But as a tradeoff, you get an extra advantage: The fact that the ONLY two digits you have to worry about are 1 and 0. So in your case you have: 11110010 + 11001101 So, numbered by digits from the right, we have: 1. Add 0 and 1, get 1, leave it for 1. 2. Add 1 and 0, get 1, leave it for 11. 3. Add 0 and 1, get 1, leave it for 111. 4. Add 0 and 1, get 1, leave it for 1111. 5. Add 1 and 0, get 1, leave it for 11111. 6. Add 1 and 0, get 1, leave it for 111111. 7. Add 1 and 1, get 0, leave it for 0111111 and carry a 1. 8. Add 1 and 1 and the carried 1, get 1, leave it for 10111111 and carry a 1. 9. Stick in that second carried 1 for 110111111 It's that easy. Now all we have to do is convert to decimal, which is almost as easy. Going up in digits we have: 1 + 2 + 4 + 8 + 16 + 32 + 0 + 128 + 256 = 447 However, all the above is if you're doing simple binary addition. The other possibility is that you're doing signed two's complement addition, dropping digits above the 8th digit and using the highest bit as a sign bit (that is, -128 rather than 128). In that case we have: 1 + 2 + 4 + 8 + 16 + 32 + 0 + -128 = -65 Since you have -65 listed in your list of answers, I suspect that the question is intended to be about signed 8-bit two's complement addition. However, as you see the principle is the same, you just throw away bits higher than the maximum bit and use the maximum bit as a negative instead.
2016-05-21 23:55:38
·
answer #2
·
answered by Anonymous
·
0⤊
0⤋
words are made of letters, and letters are coded using ASCII. If you know HEX then you can easily convert the ASCII numbers to binary.
Example: the letter A is represented by 0x41 HEX, which is 01000001 binary.
2006-10-27 02:20:52
·
answer #3
·
answered by justme 7
·
0⤊
0⤋