# Fractions

Bert Bates
author
Sheriff
Posts: 8900
5
Given the digits from 1 to 9, and using each digit once, create three fractions of the form:

x
----- ( x is a 1 digit number, y y is a two digit number)
y y
so that:

(break out your for loops )
[ June 05, 2003: Message edited by: Bert Bates ]

Joel McNary
Bartender
Posts: 1840
5/34 + 7/68 + 9/12 = 1

Greg Harris
Ranch Hand
Posts: 1012
> 5/34 + 7/68 + 9/12 = 1
joel beat me to the post... this code is very messy - but it works. i hate nested for loops!

Michael Morris
Ranch Hand
Posts: 3451
Damn Joel, you beat me again. Stupid assed sattelite connection went down.
Here's my code:

Joel McNary
Bartender
Posts: 1840
For the record, here's my code:
Anagrammer.java

Fractions.java

Not the most elegant solution, (and the print out is sloppy), but it was developed in 3 minutes (I already had the Anagrammer class written....)
I spent half the day trying to do it by hand, just to see it I could. No such luck, so I threw this code together
[ June 06, 2003: Message edited by: Joel McNary ]

Bert Bates
author
Sheriff
Posts: 8900
5
Joel, Michael, Greg -
WOW !!! You guys did that fast!!! A lot faster than I did it (which may be damned by faint praise ),
I seem to recall some sort of recursive solution...
A friend once described his very elegant high level design for the 'knight's tour' problem, which I'll post next.