RosettaCodeData/Task/Count-in-factors/BASIC256/count-in-factors.basic
2023-07-01 13:44:08 -04:00

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