Answers for "gcd(a, m)"

C++
1

gcd of number

// pass two value to this function
    public static int HCF(int a, int b) 
    {
        while (b > 0) 
        {
            int temp = b;
            b = a % b; // % is remainder
            a = temp;
        }
        return a;
    }
Posted by: Guest on February-10-2022
2

gcd algorithm

function gcd(a, b)
    if b = 0
        return a
    else
        return gcd(b, a mod b)
Posted by: Guest on September-22-2020
0

GCD(x, yz)

long long g = gcd(x, y);
return g * gcd(x / g, z);
Posted by: Guest on October-27-2021

Browse Popular Code Answers by Language