home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
libbasic
/
factoril.bas
< prev
next >
Wrap
BASIC Source File
|
1992-01-28
|
434b
|
26 lines
'this program computes a factorial for a keyboard entered
'number and displays the result
INPUT"Please enter a number>"; entry
result = 1
[recurringLoop]
counter = counter + 1
IF counter > entry THEN [skip]
result = result * counter
GOSUB [recurringLoop]
[skip]
entry = entry - 1
IF entry = 1 THEN [end]
RETURN
[end]
PRINT"The factorial is: "; result