The algorithm for binary addition
1
0
0
1
1
1
0
0
no carry
print 1
carry
print 1
0
0
0
0
1
1
1
0
0
1
1
0
0
1
1
1
no carry
print 0
carry
print 0
0
0
1
1
0
1
1
0
This is a finite state automaton. It decides what transition to
make by looking at the next column. It prints after making
the transition.
It moves from right to left over the two input numbers.