Jump to content

Factorial: Difference between revisions

m
→‎[[Factorial function#ALGOL 68]]: use a more authentic DO OD loop.
(→‎Iterative: factorial(0) == 1)
m (→‎[[Factorial function#ALGOL 68]]: use a more authentic DO OD loop.)
Line 32:
=={{header|ALGOL 68}}==
===Iterative===
PROC factorial = (INT inupb n)LONG LONG INT:(
LONG LONG INT nz := in n1;
LONGFOR LONGn INTTO upb n DO z *:= n OD;
WHILE n>1 DO
n -:= 1;
z *:= n
OD;
z
);
 
===Recursive===
PROC factorial = (INT n)LONG LONG INT:
Cookies help us deliver our services. By using our services, you agree to our use of cookies.