PDA

View Full Version : Finding the GCF in Java


Popsycle
06-06-2005, 07:06 PM
Hey, I'm doing a project with Java, and I need to find the GCF of a fraction. I really don't know how to do this, and would like a code to basically reduce the fraction. Like 12 over 6. The GCF is 6, and the fraction is reduced to 2 over 1.

I am using J builder, not sure if it would make a difference

Thanx in advance

L7Sqr
06-07-2005, 06:11 PM
GCD/GCF....
here is an easy way to go about it....Euclid's Algorithm (http://home.earthlink.net/~usondermann/gcd.html)
Note that this is not code, it is a method you can use.
The code should be easy after understanding the method.

suryad
06-08-2005, 12:22 AM
I also found this link that could help maybe...good luck http://www.merriampark.com/gcd.htm