comparison lab3/fac0.p @ 0:bfdcc3820b32

Basis
author Mike Spivey <mike@cs.ox.ac.uk>
date Thu, 05 Oct 2017 08:04:15 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:bfdcc3820b32
1 (* lab3/fac0.p *)
2
3 var n, f;
4
5 proc fac();
6 begin
7 if n = 0 then
8 return f;
9 else
10 f := f*n; n := n-1;
11 return fac()
12 end
13 end;
14
15 begin
16 n := 10; f := 1;
17 print fac(); newline
18 end.
19
20 (*<<
21 3628800
22 >>*)