i dunno...i just wanna know how this works so when my teacher asks me im not all "well i got it off the internet"
Type: Posts; User: xerxes1986
i dunno...i just wanna know how this works so when my teacher asks me im not all "well i got it off the internet"
ouch. try me.
i understand HOW the function actually goes about working
i don't understand WHY it works...WHY does calling itself over and over get you the gcd????????????\
what about my code? does...
ya but it didn't make a whole lot of sense...what about my code?
would this bit of code work????
int gcd (int numer, int denom)
{
if (denom == 0)
return numer;
return gcd(denom,numer % denom);
}
yeah but i really don't understand HOW this works....i don't want to use this code if i don't understand it
i don't understand why this works:
int gcd(int a, int b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}