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

21 lines
390 B
Text

for i = 1 to 20
print i, " = ", factorial$(i)
next i
end
sub factorial$ (num)
local f$, x$
f$ = "" : x$ = ""
if num = 1 return "1"
fct = 2
while fct <= num
if mod(num, fct) = 0 then
f$ = f$ + x$ + str$(fct)
x$ = " x "
num = num / fct
else
fct = fct + 1
end if
wend
return f$
end sub