10 PRINT "AVERAGE GROWTH RATE, FUTURE PROJECTIONS"
20 PRINT
29 REM - SET ARRAY S TO NUMBER OF YEARS PAST FIGURES KNOWN
30 DIM S(20)
39 REM - STATEMENTS 40 TO 120 REQUEST USER INPUT
40 PRINT "NUMBER OF YEARS FIGURES ESTABLISHED";
50 INPUT N
60 FOR I=1 TO N
70 IF I>1 THEN 100
80 PRINT "FIGURE: YEAR";I;
90 GOTO 110
100 PRINT "        yEAR";I;
110 INPUT S(I)
120 NEXT I
129 REM - INITIALIZE VARIABLES FOR FIRST YEAR
130 T=LOG(S(1))
140 V=0
149 REM - LOOP FOR REMAINING YEARS OF HISTORY
150 FOR I=2 TO N
160 L=LOG(S(I))
170 T=T+L
180 V=V+(I-1)*L
190 NEXT I
199 REM - CALCULATE AVERAGE GROWTH RATE
200 A=6*(2*V/(N-1)-T)/(N)/(N+1)
210 G=EXP(A)-1
219 REM - ROUND OFF, PRINT
220 PRINT "AVERAGE GROWTH RAT =";INT(G*10000+.5)/100;"%"
230 PRINT
239 REM - CALCULATE AVERAGE ANNUAL GROWTH FACTOR
240 S=EXP(T/N-A*(N-1)/2)
250 PRINT "(ENTER 0 TO END PROGRAM)"
259 REM - INPUT YEAR NUMBER
260 PRINT "PROJECTED SALES FOR YEAR";
270 INPUT Y1
279 REM - TEST FOR END OF PROGRAM
280 IF Y1=0 THEN 320
289 REM - CALCULATE PROJECTED SALES FIGURE
290 S1=S*(1+G)[(Y1-1)
299 REM - ROUND OFF, PRINT
300 PRINT "                            =";INT(S1*100+.5)/100
309 REM - RETURN FOR MORE DATA
310 GOTO 260
320 END
