26 lines
526 B
Plaintext
26 lines
526 B
Plaintext
10 REM Trabb Pardo-Knuth algorithm
|
|
20 REM Used "magic numbers" because of strict
|
|
30 REM specification of the algorithm.
|
|
40 DEF FNF(N)=SQR(ABS(N))+5*N*N*N
|
|
50 DIM S(10)
|
|
60 PRINT "Enter 11 numbers."
|
|
70 FOR I=0 TO 10
|
|
80 PRINT STR$(I+1);
|
|
90 INPUT S(I)
|
|
100 NEXT I
|
|
110 PRINT
|
|
120 REM ** Reverse
|
|
130 FOR I=0 TO 10/2
|
|
140 TMP=S(I)
|
|
150 S(I)=S(10-I)
|
|
160 S(10-I)=TMP
|
|
170 NEXT I
|
|
180 REM ** Results
|
|
190 FOR I=0 TO 10
|
|
200 PRINT "f(";STR$(S(I));") =";
|
|
210 R=FNF(S(I))
|
|
220 IF R>400 THEN PRINT " overflow":GOTO 240
|
|
230 PRINT R
|
|
240 NEXT I
|
|
250 END
|