How do you find the least common denominator for a fraction?
I am using a class to create a custom data class for fractions. It will be implemented with a class "Fraction." The data will be two integers, numerator and denominator.
The problem is, I have to be able to reduce each fraction. For instance, 8/2 should equal 4/1 and 2/8 should equal 1/4. I was told that if you took either number, divided it by the other ( like 127/9 ) and kept divideding then the divisor by the remainder, you would come up with the LCM. Is this true? how do you implement this?




Reply With Quote