home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nibble Magazine
/
nib26b.dsk
/
SUBR.MAST.DEMO2.bas
< prev
next >
Wrap
BASIC Source File
|
2023-02-26
|
851b
|
19 lines
10 REM **********************
20 REM * SUBR.MAST.DEMO2 *
30 REM * COPYRIGHT (C) 1985 *
40 REM * BY MICROSPARC, INC *
50 REM * CONCORD, MA 01742 *
60 REM **********************
70 IF PEEK(104) < >17 THEN POKE 103,44: POKE 104,17: POKE 4395,0: PRINT CHR$(4)"RUN SUBR.MAST.DEMO2"
80 IF PEEK(2304) < >32 THEN PRINT CHR$(4)"BLOAD SUBR.MASTER"
90 FACT = 3141:EXIT = 4058: HOME : VTAB 12: PRINT "FACTORIAL CALCULATIONS USING RECURSION": PRINT : PRINT "* COPYRIGHT (C) 1985 BY MICROSPARC, INC*": VTAB 21: PRINT "PRESS <RETURN> TO START";: GET Z$: PRINT : HOME
100 INPUT "INPUT INTEGER (0 TO 33): ";A
110 RS = 1: REM INITIALIZE RESULT TO 1
120 CALL FACT,A
130 PRINT RS
140 GOTO 100
150 REM *** BEGINNING OF FACT ROUTINE
160 DEF FACT,N
170 IF N >1 THEN RS = RS *N: CALL FACT,N -1
180 CALL EXIT,FACT
190 REM *** END OF FACT ROUTINE