| author | nipkow | 
| Mon, 10 Jun 2013 16:04:34 +0200 | |
| changeset 52362 | 6b80ba92c4fe | 
| parent 45044 | 2fae15f8984d | 
| permissions | -rw-r--r-- | 
| 45044 | 1 | package body Greatest_Common_Divisor | 
| 2 | is | |
| 3 | ||
| 4 | procedure G_C_D(M, N: in Natural; G: out Natural) | |
| 5 | is | |
| 6 | C, D, R: Integer; | |
| 7 | begin | |
| 8 | C := M; D := N; | |
| 9 | while D /= 0 loop | |
| 10 | --# assert C >= 0 and D > 0 and Gcd(C, D) = Gcd(M, N); | |
| 11 | R := C rem D; | |
| 12 | C := D; D := R; | |
| 13 | end loop; | |
| 14 | G := C; | |
| 15 | end G_C_D; | |
| 16 | ||
| 17 | end Greatest_Common_Divisor; |