int gcd (int num1, int num2)
{
int remainder;
if (num1 > num2)
remainder = num1 % num2;
else
remainder = num2 % num1;
if(remainder!=0)
{
return gcd(remainder, num1);
}
return num1;
}
int gcd2 (int num1, int num2)
{
int remainder;
return ( remainder = ( num1 > num2 ? num1 % num2 : num2 % num1)==0 ? num1
: gcd2(remainder, num1));
}
its bothering me when passed the same parameters to these two above functions, they give different results.
any idea whats up with them