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

17 lines
298 B
Text

for i = 1000 to 1016
print i;" = "; factorial$(i)
next
wait
function factorial$(num)
if num = 1 then factorial$ = "1"
fct = 2
while fct <= num
if (num mod fct) = 0 then
factorial$ = factorial$ ; x$ ; fct
x$ = " x "
num = num / fct
else
fct = fct + 1
end if
wend
end function