1 :
COLOR 9
CLS
PRINT "Arithmatic Sequence Variable Resolver"
PRINT "tn = a+(n-1)d"
PRINT
PRINT
INPUT "What is the first term? (a)"; a
INPUT "What is the number of terms (n)"; n
INPUT "What is the common difference (d)"; d
INPUT "what is the value of the nth number (tn)"; tn
CLS
IF a = 0 THEN GOTO afind
IF n = 0 THEN GOTO nfind
IF d = 0 THEN GOTO dfind
IF tn = 0 THEN GOTO tnfind
REM --------------------- A FIND ------------------
afind:
PRINT "tn = a+(n-1)d"
PRINT tn; "="; "?+("; n; "- 1)"; d
n2 = n - 1
d2 = n2 * d
a = tn / d2
PRINT "------------"
PRINT "The first term is (a): "; a
PRINT
PRINT
INPUT "Another? (1=yes   enter=no) ", rep
IF rep = 1 THEN GOTO 1:
IF rep = 0 THEN GOTO 2:
REM ------------------------- N Find ----------------------
nfind:
PRINT "tn = a+(n-1)d"
PRINT tn; "="; a; "+"; "(? - 1)"; d
tn = tn - a + d
n = tn / d
PRINT "------------"
PRINT "The number of terms is (n): "; n
PRINT
PRINT
INPUT "Another? (1=yes   enter=no) ", rep
IF rep = 1 THEN GOTO 1:
IF rep = 0 THEN GOTO 2:
REM ------------------------- Find D ----------------------
dfind:
PRINT "tn = a+(n-1)d"
PRINT tn; "="; a; "+("; n; "- 1)"; d
n2 = n - 1
tn = tn - a
d = tn / n2
PRINT "------------"
PRINT "The common difference is (d): "; d
PRINT
PRINT
INPUT "Another? (1=yes   enter=no) ", rep
IF rep = 1 THEN GOTO 1:
IF rep = 0 THEN GOTO 2:
REM ------------------------------- Find tn ---------------------
tnfind:
PRINT "tn = a+(n-1)d"
PRINT "tn ="; a; "+("; n; "-1)"; d
n2 = n - 1
d2 = n2 * d
tn = d2 + a
PRINT "------------"
PRINT "The last term value is (tn): "; tn
PRINT
PRINT
INPUT "Another? (1=yes   enter=no) ", rep
IF rep = 1 THEN GOTO 1:
IF rep = 0 THEN GOTO 2:

2 :
COLOR 0
END







