Assignment
Read the write-ups on "Number bases:"
Below are two examples showing how to perform addition of numbers, one for numbers in binary, the other for numbers in hexadecimal. It parallels how it's done in decimal.
Assignment:
Perform the following addition problems in binary and hex.
BINARY:
1) 0101 2) 0101
3) 0111
+1010 +1011
+0111
HEXADECIMAL:
4) 4817 5) 4817
6) 4817 7) 4817
+3172 +3173
+3179 +317F
8) 4817 9) 4817 10) B4AC
+B172
+B972 +FD86
For each of the above sums, identify which of the provided answers is the correct one:
1. 0101 + 1010
a. 1000
b. 10000
c. 0001
d. 1110
e. 1111
2. 0101 + 1011
a. 1000
b. 10000
c. 0001
d. 1110
e. 1111
3. 0111 + 0111
a. 1000
b. 10000
c. 0001
d. 1110
e. 1111
4. 4817 + 3172
a. 7990
b. 1B232
c. F989
d. 10189
e.798A
f. 7996
g. 7989
5. 4817 + 3173
a. 7990
b. 1B232
c. F989
d. 10189
e.798A
f. 7996
g. 7989
6. 4817 + 3179
a. 7990
b. 1B232
c. F989
d. 10189
e.798A
f. 7996
g. 7989
7. 4817 + 317F
a. 7990
b. 1B232
c. F989
d. 10189
e.798A
f. 7996
g. 7989
8. 4817 + B172
a. 7990
b. 1B232
c. F989
d. 10189
e.798A
f. 7996
g. 7989
9. 4817 + B972
a. 7990
b. 1B232
c. F989
d. 10189
e.798A
f. 7996
g. 7989
10. B4AC + FD86
a. 7990
b. 1B232
c. F989
d. 10189
e.798A
f. 7996
g. 7989
Examples:
BINARY ADDITION EXAMPLE
0111
+1110
We proceed column-wise, from right to left, just as we do in decimal, noting carries where they occur. So first, we take care of the right-most column (the one's column).
0111
+1110
1 plus 0 is 1. Write it down.
0111
+1110
1
Now proceed to the 2nd-from-right column (the two's column).
0111
+1110
1
1 plus 1 is... Well, for us it's 2. But the binary number system doesn't have "2"!! They have only 0 and 1. So the way they write this number "2" is 10 (one in the two's column and none in the one's column-- grand total is two). But that number, 10, takes up two columns and so can't fit into the sum's 2nd column. So we put there just the "0" part of 10, and carry the "1" part of 10 to the next column. (This exactly parallels the carry operation in decimal, with which you are familiar.)
1
0111
+1110
01
Now proceed to the 3rd-from-right column (the four's column).
1
0111
+1110
01
1 plus 1 plus 1 is... Well, for us it's 3. But the binary number system doesn't have "3"!! They have only 0 and 1. So the way they write this number "3" is 11 (one in the two's column plus one in the one's column-- grand total is three). But that number, 11, takes up two columns and so can't fit into the sum's 3rd column. So we put there just the right-most "1" part of the 11, and carry the left-most "1" part of 11 to the next column.
1
0111
+1110
101
Now proceed to the 4th-from-right column (the eight's column).
1
0111
+1110
101
1 plus 0 plus 1 is... Well, 2. But 2 in this number system is 10. But that number, 10, takes up two columns and so can't fit into the sum's 4th column. So we put there just the "0" part of 10, and carry the "1" part of 10 to the next column.
1
0111
+1110
10101
10101, then, is the final sum. 0111 plus 1110 is 10101. One way to check this is to convert each of these numbers to decimal and see if it works. 0111 is seven. 1110 is fourteen. We hope therefore that 10101 is twenty-one. Is it?
HEXADECIMAL ADDITION EXAMPLE
We have the usual numerals 0 through 9 to work with, plus 6 others. They are A representing ten, B representing eleven, C representing twelve, D representing thirteen, E representing fourteen, and F representing fifteen.
4817
+792B
We proceed column-wise, from right to left, just as we do in decimal, noting carries where they occur. So first, we take care of the right-most column (the one's column).
4817
+792B
7 plus B means 7 plus eleven. That's eightteen. In hexadecimal we write that as a 2-digit number, with one digit in the sixteen's column and the other in the one's column. Let's use the digit 1 in the sixteen's column. Then, representing the balance in the one's column, we put 2. 7 plus B is 12 in hexadecimal (that's NOT twelve, you would pronounce it "one two" in conversation). We enter the 2 in the sum's 1st column, and carry the 1 to the 2nd.
1
4817
+792B
2
Now proceed to the 2nd-from-right column (the sixteen's column).
1
4817
+792B
2
1 plus 1 plus 2 is 4. Enter 4 in the sum's 2nd-from-right column.
1
4817
+792B
42
Now proceed to the 3nd-from-right column (the two-hundred-fifty-six's column).
4817
+792B
42
9 plus 8 is seventeen. In hexadecimal we write that as a 2-digit number, with one digit in the sixteen's column and the other in the one's column. Let's use the digit 1 in the sixteen's column. Then, representing the balance in the one's column, we put 1. 8 plus 9 is 11 in hexadecimal (that's NOT eleven, you would pronounce it "one one" in conversation). We enter the first 1 in the sum's 3rd column, and carry the second 1 to the 4th column.
1
4817
+792B
142
Now proceed to the 4nd-from-right column (the four-thousand-ninety-six's column).
1
4817
+792B
142
1 plus 4 plus 7 is twelve in decimal. In hexadecimal we have a digit for that, namely C. So put C in the sum's 4th column.
1
4817
+792B
C142
C142, then, is the final sum. 4817 plus 392B is C142. One way to check this is to convert each of these numbers to decimal and see if it works.
4817 in hexadecimal is (7 x 1) + (1 x 16) + (8 x 256) + (4 x 4096) = 18455 in
decimal.
792B in hexadecimal is (11 x 1) + (2 x 16) + (9 x 256) + (7 x 4096) = 31019 in
decimal.
The decimal sum is 18455 + 31090 = 49474. We hope therefore that hexadecimal C142 is decimal 49474. Is it?