Hello,
I’m trying to find the greatest common divisor (GCD) of two numbers. I’m following the instructions from this article.
I’m using the following code to find the GCD:
int gcd(int a, int b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}
The problem is that when I try to run the code, I get a runtime error. I’m not sure what I’m doing wrong - can someone please help me out?
Thanks in advance!