1124586Smtmpackage body Greatest_Common_Divisor 2124586Smtmis 3124586Smtm 4124586Smtm procedure G_C_D(M, N: in Natural; G: out Natural) 5124586Smtm is 6124586Smtm C, D, R: Integer; 7124586Smtm begin 8124586Smtm C := M; D := N; 9124586Smtm while D /= 0 loop 10124586Smtm --# assert C >= 0 and D > 0 and Gcd(C, D) = Gcd(M, N); 11124586Smtm R := C rem D; 12124586Smtm C := D; D := R; 13124586Smtm end loop; 14124586Smtm G := C; 15124586Smtm end G_C_D; 16124586Smtm 17124586Smtmend Greatest_Common_Divisor; 18124586Smtm