Originally Posted by

**RichardPressler** My recommendation would be a loop that just takes your decimal, and multiplies it by each positive integer, starting from 1, until it get's a whole number. For an example number of 4.25, it would basically do this:

4.25 * 1 = 4.25 (not a whole number)

4.25 * 2 = 8.5 (not a whole number)

4.25 * 3 = 12.75 (not a whole number)

4.25 * 4 = 17 (GREAT! A whole number!)

The loop should stop once you find a multiplier that will make your number a whole number, so for that example, the loop would stop at 4, and save the numbers 4 and 17. That's actually your formula for getting the fraction. it would be 17/4. Remember that you can use the modulus operator (%) to see if your result is divisible by 1, and if it is, then it's a whole number.