ErwinOlie
11/13/2019 - 8:36 AM

Euclid's algorithm

public class EuclidsAlgorithm {

    public static int gcd(int p, int q) {
        if (p == 0) return p;
        int r = p % q;
        return gcd(q, r);
    }
}