Euclidean Algorithm

Back

Euclidean Algorithm is used to calculate the gcd of two numbers x, y

Example

int gcd(int x, int y) {
    while(y !=0)
        t = y
        y = x % y
        x = t
    return x
}

See Also