English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2 answers

These are actually much easier than decimal, once you get the hang of it. Send me an email for more information.

For addition, you need to know the truth table to add. You can add 2 numbers, and there might be a carry (C), so the truth table looks like this:

C # # =
0 0 0 = 0
0 0 1 = 1
0 1 0 = 1
0 1 1 = 0 + C
1 0 0 = 1
1 0 1 = 0 + C
1 1 0 = 0 + C
1 1 1 = 1 + C

So now I want to add two numbers. Binary 5 and binary 7 will do nicely.

101
111
=?

The first column (1s) has two numbers, both with ones, no carry. According to the truth table, the first column on the answer should have a zero, plus a carry. So far your answer is 0.

The second column (2s) has a carry, a zero, and 1. The truth table says for a carry, 0, and 1, you get a zero plus a carry. So the second column on your answer should also have a zero. Now your answer is 00.

The third column (4s) has a carry, 1, and 1. The truth table says for a carry, 1, and 1, you get 1 plus a carry. So your third column on your answer should have a 1. Now your answer is 100.

The fourth column (8s) has a carry, 0, and 0. The truth table says for a carry, 0, and 0 you get 1. So your fourth column on your answer should have a 1. Your final answer is 1100. This is binary for 12.

You added a binary 5 with a binary 7 and got binary 12. That is correct.

For Multiplication:
This is very easy. If you can do multiplication in decimal, you can do it in binary. This is because you are either mulitiplying by 1 or 0. Same rules apply as in binary. Anything multiplied by 1 is the same number, anything multiplied by zero is zero.

For example: Binary 5 times binary 5:
_101
x101
-------
__101
10100
--------
Notice that 1 * 101 is 101 in binary AND decimal.
Notice that 100 * 101 is 10100 in binary AND decimal.
The only difference is the addition. Binary gets you 11001 and decimal comes out to 10, 201.

2007-02-13 04:44:18 · answer #1 · answered by Thegustaffa 6 · 1 0

Continuing from the previous post:

Subtraction is the same as addition, except you apply the 2's complement on the second operand before adding.

I can't remember multiplication off the top of my head.

Division uses long division in binary, it works the same as in decimal.

2007-02-13 14:21:15 · answer #2 · answered by Pfo 7 · 0 0

fedest.com, questions and answers