annotate lab3/fac0.p @ 1:b5139af1a420 tip basis

Fixed permissions on compile scripts
author Mike Spivey <mike@cs.ox.ac.uk>
date Fri, 13 Oct 2017 17:27:58 +0100
parents bfdcc3820b32
children
rev   line source
mike@0 1 (* lab3/fac0.p *)
mike@0 2
mike@0 3 var n, f;
mike@0 4
mike@0 5 proc fac();
mike@0 6 begin
mike@0 7 if n = 0 then
mike@0 8 return f;
mike@0 9 else
mike@0 10 f := f*n; n := n-1;
mike@0 11 return fac()
mike@0 12 end
mike@0 13 end;
mike@0 14
mike@0 15 begin
mike@0 16 n := 10; f := 1;
mike@0 17 print fac(); newline
mike@0 18 end.
mike@0 19
mike@0 20 (*<<
mike@0 21 3628800
mike@0 22 >>*)