Posted by Frank Hale on 1999-05-07
Luke Jordan wrote: > > Hi, I wrote a Computer Olympiad today, which, for those unfamiliar with > them, is basically a hybrid coding/problem solving exam. The whole thing was > dead easy, except the last question, which I didn't get fully. The question > was to write a routine that took a fraction, given as two integers, and > return it in its decimal form. That's really easy, but the hard part was > that if the fraction had repeating digits, you had to put them in brackets, > e.g.: > 1/3 = 0.3333333 = 0.(3). > This brackets bit has me completely stumped. Any ideas? You can't pass the function strings and parse the input into integers then make a crude expression evaluator to evaluate the parenthesis?? Anyway just a thought. -- From: Frank Hale Email: frankhale@xxxxx.xxx ICQ: 7205161 Linux: http://www.netalive.org/nets_linux.html
Previous post | Next post | Timeline | Home