view 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
line wrap: on
line source
(* lab3/gcdfun.p *)

proc gcd(x, y);   
begin
  while x <> y do
    if x > y then
      x := x - y
    else
      y := y - x
    end
  end;
  return x
end;

begin
  print gcd(3*37, 7*37); newline
end.

(*<<
 37
>>*)