11 lines
138 B
Text
11 lines
138 B
Text
|
|
function factorial (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
|