English Français Deutsch

Factorial

' Write a function to return the factorial of a number.

function fact(n)
set result = 1
if n > 1
set k = 2
while k <= n
set result = result * k
set k = k + 1
end while
end if
end function

set i = 1
while i < 10
echo fact(i)
set i = i+1
end while

Write a function to return the factorial of a number.

1

2

6

24

120

720

5040

40320

362880