print "======================================"
print "Adder Version 1.0 by S.T.C."
print "Add 2 numbers Max is 1 with 79 zeros"
print "Handles Very Big Numbers!!!"
print "======================================"
print "Number1?";
input ns1$;
print ""
print "Number2?";
input ns2$;
print ""
L1 = len(ns1$)
L2 = len(ns2$)
if L1 = L2 then
L = L1
s1$ = ns1$
s2$ = ns2$
endif
if L1 > L2 then
L = L1
s1$ = ns1$
s2$ = ns2$
else
L = L2
s1$ = ns2$
s2$ = ns1$
endif
P1 = len(s1$)
P2 = len(s2$)
P3 = P1 - P2
P$ = ""
FOR Pad = 1 to P3
P$ = P$ + "0"
Next Pad
s2$ = P$ + s2$
X = L
carry1$ = ""
ans$ = ""
for J = 1 to 80
a1$ = mid$(s1$,X,1)
a2$ = mid$(s2$,X,1)
if X < 1 then
if carry1$ = "" then
goto Done:
endif
a1$ = "0"
a2$ = "0"
endif
if a2$ = "" then
a2$ = "0"
endif
m1 = val(a1$)
m2 = val(a2$)
m3 = m1 + m2
if carry1$ > "" then
carry1$ = ltrim$(carry1$)
v = val(carry1$)
m3 = m3 + v
carry1$ = ""
endif
tst$ = str$(m3)
tst$ = ltrim$(tst$)
tst1 = len(tst$)
use$ = tst$
if tst1 > 1 then
carry1$ = mid$(tst$,1,1)
use$ = mid$(tst$,2,1)
endif
ans$ = use$+ans$
X = X - 1
next J
Done:
print "======================================"
print "Sum =";
print ans$
print "======================================"
k$ = ""
while k$ = ""
k$ = inkey$
wend
END