Next, we will consider how to make a program that adds 1 to any number between 0 and 9.

First we need a way to represent the numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 with only the bit values 0 and 1. The following table shows how we will do it.

## Table 1

``` number  representation
0  0000
1  0001
2  0010
3  0011
4  0100
5  0101
6  0110
7  0111
8  1000
9  1001
```

Next we need a table indicating what the answer is for each possible number 0 to 9.

## Table 2

``` number  answer
0   1
1   2
2   3
3   4
4   5
5   6
6   7
7   8
8   9
9  10
```

Next, we rewrite this table as:

## Table 3

``` number  answer
0  01
1  02
2  03
3  04
4  05
5  06
6  07
7  08
8  09
9  10
```

Next, we use table 1 to write table 3 with 1's and 0's. That is, we replace all 0's in table 3 with 0000, all 1's with 0001, and both 2's with 0010, etc. This gives us the following table.

## Table 4

``` number  answer
0000  00000001
0001  00000010
0010  00000011
0011  00000100
0100  00000101
0101  00000110
0110  00000111
0111  00001000
1000  00001001
1001  00010000
```

Next, we write table 4 as data in memory.

## Table 5

``` label       address             data         comment
0000000001000001  0000000000000010
0000000001000010  0000000000000011
0000000001000011  0000000000000100
0000000001000100  0000000000000101
0000000001000101  0000000000000110
0000000001000110  0000000000000111
0000000001000111  0000000000001000
0000000001001000  0000000000001001
0000000001001001  0000000000010000
```

This kind of table is called a lookup table because you can look up the answer in it. A lookup table can be made to do any function with a limited number of possible inputs. This function is called 'increment' (add 1) and has 10 possible inputs: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.

Next, we decide where the number to increment and the answer will be stored in memory.

``` label       address             data                  comment

0000000000000000  0000000000100000       start0000000000001000
0000000000000001  0000000000001001        number to increment
```

Next, we write the program. The program is a list of instructions that tell the processor how to manipulate data. That is, the program tells the processor from where and to where copy data.

``` label       address             data                  comment

0000000000001010  0000000000001111        'to' bits to copy to