annotate lab3/gcdfun.p @ 0:bfdcc3820b32

Basis
author Mike Spivey <mike@cs.ox.ac.uk>
date Thu, 05 Oct 2017 08:04:15 +0100
parents
children
rev   line source
mike@0 1 (* lab3/gcdfun.p *)
mike@0 2
mike@0 3 proc gcd(x, y);
mike@0 4 begin
mike@0 5 while x <> y do
mike@0 6 if x > y then
mike@0 7 x := x - y
mike@0 8 else
mike@0 9 y := y - x
mike@0 10 end
mike@0 11 end;
mike@0 12 return x
mike@0 13 end;
mike@0 14
mike@0 15 begin
mike@0 16 print gcd(3*37, 7*37); newline
mike@0 17 end.
mike@0 18
mike@0 19 (*<<
mike@0 20 37
mike@0 21 >>*)