PROGRAM EUCLID_GCD
VAR
a, b, r: extended;
(* Use type real if you do not have extended *)
(* precision, but his limits the number of *)
(* significant figures to about 11. *)
BEGIN
writeln ('type two positive number separated by a space');
read (a, b);
writeln ('gcd of', a:0:0, 'and', b:0:0, 'is');
(* Since a and b change their values during the *)
(* program, we have to put this here !*)
WHILE b > 0 DO
BEGIN
r := a - b * INT (a/b);
a := b; b := r;
END;
writeln (a:0:0);
END.