Next, we will consider how to make a program that adds two numbers, from 0 to 9 together.Again, we will represent the numbers 0 through 9 with only 1's and 0's as indicated in the following table.
Table 6
Number Representation 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001Next, we need a table that shows the answer for each possible pair of numbers from 0 to 9. This is the addition table we studied so hard to learn in grade school and is reproduced below.
Addition Table
+ 0 1 2 3 4 5 6 7 8 9 0 0 1 2 3 4 5 6 7 8 9 1 1 2 3 4 5 6 7 8 9 10 2 2 3 4 5 6 7 8 9 10 11 3 3 4 5 6 7 8 9 10 11 12 4 4 5 6 7 8 9 10 11 12 13 5 5 6 7 8 9 10 11 12 13 14 6 6 7 8 9 10 11 12 13 14 15 7 7 8 9 10 11 12 13 14 15 16 8 8 9 10 11 12 13 14 15 16 17 9 9 10 11 12 13 14 15 16 17 18Next, we rewrite the addition table above as below.
Addition Table Listing
0 + 0 = 00 0 + 1 = 01 0 + 2 = 02 0 + 3 = 03 0 + 4 = 04 0 + 5 = 05 0 + 6 = 06 0 + 7 = 07 0 + 8 = 08 0 + 9 = 09 1 + 0 = 01 1 + 1 = 02 . . . 8 + 9 = 17 9 + 0 = 09 9 + 1 = 10 9 + 2 = 11 9 + 3 = 12 9 + 4 = 13 9 + 5 = 14 9 + 6 = 15 9 + 7 = 16 9 + 8 = 17 9 + 9 = 18Only some of the table elements are listed above to save space.
Page 29
Page 28 . . . Page 1 . . . Page 30