how to find gcd of multiple numbers in c++ code example
Example: gcd of two numbers c++
// gcd function definition below:
int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
int a = 105, b = 30;
cout<<"GCD of "<< a <<" and "<< b <<" is "<< gcd(a, b);
// output = "GCD of 105 and 30 is 15";