Answers for "c++ program to find gcd of two numbers"

C++
6

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";
Posted by: Guest on September-16-2020

Code answers related to "c++ program to find gcd of two numbers"

Browse Popular Code Answers by Language