aboutsummaryrefslogtreecommitdiff
path: root/examples/factorial.imp
blob: 0ab74cd304ffaf315ab3f486fd73feabf3764b75 (plain)
1
2
3
4
5
6
7
8
9
procedure factorial(n;r) begin
  if n <= 0 then
    r := 1;
  else
    m := n - 1;
    factorial(m;r);
    r := r * n;
  end;
end;