Even if C
is
a
two-digit
number. only the rightmost
digit
is
concatenated onto
C$.
The tens value
has
already been assigned to 0 and
will
be
added during the next
loop iteration.
N
is
set to 2 to include the last carry only if
0=1
and
1=1
(signaling a carry
on the last loop iteration). This
is
important. because if both conditions
are
true
the loop
will
NOT iterate again to add 0 carry into A in line 1040. thereby losing
the last carry value in
O.
Sy setting
t'J
to 2 on the last loop iteration, both digits of
C are included in
C$.
and the last carry over
is
not lost.
1070
IF
C)=10
THEN
D=1
cI1612\>=10
D~
1080
IF
D=1
AND
1=1
THEN
N=2
D~
I~
N~
1090
C$=RIGHT$(STR$(C).N)+C$
C$=RIGHT$(1IDill.I,2l+C$
C$=ITm+C$
C$=11j2Ixlxjxlxlxlxlxl
The entire
FOR
...
NEXT loop routine at lines 1020 through 1100 does the
following:
1.
It extracts individual digits from a numeric string and assigns numeric
values to them (statements 1030. 1050).
2.
The digits from both strings are added together one
digit
at
a time
(statement
1060), checked for a carry value (statement 1070), and the
carry
is
added to A in the next column (Iine 1040).
3.
The individual sums are then linked and converted back into a numeric
string for printing
Oine
1090).
195