10 CLEAR 500
20 PRINT
30 INPUT "HOW MANY CHARACTERS PER LINE";C:IF C<15 THEN 30 ELSE WIDTH C
40 INPUT "NUMBER OF DIGITS";L
50 IF L>255 OR L<1 OR L<>INT(L) THEN 40
60 DIM X(L)
70 U=1:E=U:Z=0:F=Z:T=10
80 X$=""
90 INPUT "ENTER N";N
100 IF N<Z OR N>9999 THEN 90
110 IF N=Z THEN END
120 IF N=U THEN F=U
130 IF INT(N)<>N THEN 90
140 IF F=Z THEN PRINT "POWERS OF";N
150 IF F=U THEN PRINT "FACTORIALS"
160 X(J)=N
170 J=Z
180 IF X(J)<T THEN 210
190 Q=X(J)/T:Q=INT(Q):R=X(J)-Q*T
200 X(J)=R:X(J+U)=X(J+U)+Q
210 J=J+U
220 IF J<L THEN 180
230 J=L
240 IF X(J)=Z THEN J=J-U:GOTO 240
250 IF J=L THEN 410
260 PRINT E;TAB(6);
270 W=J
280 V=0
290 Y$=STR$(X(W)):X$=X$+RIGHT$(Y$,U)
300 V=V+U
310 W=W-U
320 IF W>=Z THEN 290
330 IF LEN(X$)<C-6 THEN PRINT X$;:GOTO 350
340 PRINT LEFT$(X$,(C-6)):PRINT TAB(6);RIGHT$(X$,(LEN(X$)-(C-6)+1))
350 PRINT:X$=""
360 IF F=U THEN N=N+U
370 W=Z:E=E+U
380 X(W)=X(W)*N:W=W+U
390 IF W<=J THEN 380
400 GOTO 170
410 FOR W=U TO L:X(W)=Z:NEXT W
420 INPUT "WANT TO RUN THIS PROGRAM AGAIN";A$
430 IF LEFT$(A$,1)="Y" THEN RUN
440 WIDTH 72
450 END
W=U TO L:X(W)=Z:NEXT W
420 INPUT "WANT TO RUN THIS PRO