20 lines
395 B
Text
20 lines
395 B
Text
for i = 1 to 20
|
|
print i; " = "; factorial$(i)
|
|
next i
|
|
end
|
|
|
|
function factorial$ (num)
|
|
factor$ = "" : x$ = ""
|
|
if num = 1 then return "1"
|
|
fct = 2
|
|
while fct <= num
|
|
if (num mod fct) = 0 then
|
|
factor$ += x$ + string(fct)
|
|
x$ = " x "
|
|
num /= fct
|
|
else
|
|
fct += 1
|
|
end if
|
|
end while
|
|
return factor$
|
|
end function
|