求最大公约数 辗转相除法

/*求最大公约数 辗转相除法*/
public class Main {
    public static void main(String[] args) {
        System.out.println(gcd(14, 21));
    }

    static int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

}
原文地址:https://www.cnblogs.com/Alpharun/p/8640938.html