Factorial in Algol68
Example for versions
Algol68g-1.18.0,
Algol68toc-1.8
This example uses recursive factorial definition with first 7 numbers precomputed.
PROC factorial = (INT n)LONG LONG INT:
CASE n+1 IN
1,1,2,6,24,120,720 # a brief lookup #
OUT
n*factorial(n-1)
ESAC
;
Comments
]]>blog comments powered by Disqus
]]>