Posted on 1998-11-01
I have this recursive function again.
long gcd (long x, long y)
return (x==0L) ? y : gcd( y % x,x);
this is supposed to keep fractions in the lowest terms.
it works fine for addition and subtraction
how can I use it for multiplication and division.
I have always multiplied fractions like this
a/b *c/d = a *c / b*d
how can I use the gcd to reduce
thanks in advance.