Euclidean Algorithm (Programming)

See the Euclidean Algorithm

C Implementation

int gcd(int a, int b) {
    int remainder = 0;

    while (b != 0) {
        remainder = a % b;
        a = b;
        b = remainder;
    }

    return a;
}