9 lines
152 B
Text
9 lines
152 B
Text
def factorial (int n)
|
|
decl int result
|
|
set result 1
|
|
decl int i
|
|
for (set i 1) (< i (+ n 1)) (inc i)
|
|
set result (* result i)
|
|
end
|
|
return result
|
|
end
|