Answers for "gcd c"

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

Browse Popular Code Answers by Language