# how to make Simplify fractions in actionscript 3

• 12-31-2017, 11:24 AM
kofa
how to make Simplify fractions in actionscript 3
hello
At first I apologize for my bad English language
Because of this I will explain the required by image

http://a.up-00.com/2017/12/151473658532421.jpg
• 12-31-2017, 05:21 PM
Northcode
There's more than one way to skin this cat...

You could find all the prime factors of both the numerator and denominator and eliminate any factors they have in common. In your example. the prime factors of 33 are 3, 11 and the prime factors of 9 are 3, 3. Since the numerator and denominator both contain a 3, you eliminate that number (i.e. divide numerator and denominator by 3) leaving 11 / 3. Here's an algorithm to find the prime factors: https://www.geeksforgeeks.org/print-...a-given-number

Another way would be to find the GCD (greatest common divisor) of the numerator and denominator and then divide them both by the GCD. You can use Euclid's algorithm for this: https://en.wikipedia.org/wiki/Euclidean_algorithm
• 01-03-2018, 02:11 AM
kofa
Quote:

Originally Posted by kofa
hello
At first I apologize for my bad English language
Because of this I will explain the required by image

http://www.up4.cc/imagef-1514963305651-jpg.html