RosettaCodeData/Task/Left-factorials/Run-BASIC/left-factorials.basic

21 lines
386 B
Plaintext

a = lftFct(0,10,1)
a = lftFct(20,110,10)
a = lftFct(1000,10000,1000)
function lftFct(f,t,s)
print :print "------ From ";f;" --To-> ";t;" Step ";s;" -------"
for i = f to t step s
lftFct = 1
fct = 1
for j = 1 to i-1
fct = fct * j
lftFct = lftFct + fct
next j
if i >= 1000 then
print i;" ";len(str$(lftFct));" "digits"
else
print i;" ";lftFct
end if
next i
end function