1 2 3 4 5 6 7 8 9 10
/* computes n!, result is stored in r. */ procedure factorial(n;r) begin if n <= 0 then r := 1; else m := n - 1; factorial(m;r); r := r * n; end; end;