Perform the following steps to calculate the maximum common divisor of two numbers by moving phase division: first use a small number to divide a large number to obtain the first remainder, and then use the first remainder to divide a small number, the second remainder is obtained, and the second remainder is used to divide the first remainder, and the third remainder is obtained. In this way, the last remainder is removed until the remainder is 0. In this case, the last divisor is the maximum common divisor (if the last divisor is 1, the original two divisor is the mutual prime number ). For example, for the maximum number of 1515 and 600, the first time: with 600 except 1515, the merchant 2 more than 315; the second time: with 315 except 600, the merchant 1 more than 285; the third time: 285 in addition to 315, more than 1 30; fourth time: 30 in addition to 285, more than 9 15; fifth time: 15 in addition to 30, more than 2 0. The maximum number of public appointments between 1515 and 600 is 15.Int gcd (int x, int y) {If (x <Y) int T = x, x = Y, y = T; return y = 0? X: gcd (Y, X % Y );}
Maximum common approx.