rem Nの階乗の計算(再帰処理による)
n as integer
print "Nの階乗 Number: "
input n
print
print n;"の階乗: "; n ;" "; myfact(n)
wait key
end

function myfact( n )
result as integer
if n=0 then exitfunction
result = n*myfact(n-1)
endfunction result