Today’s puzzler should be a rather simple one, but I’m curious to see how folks solve it. Don’t forget - these Friday Puzzler’s are meant to be quick tests of your ColdFusion coding skills. If you can’t solve it in five minutes, than take a break. (If I get someone fired I’ll feel so guilty. At least for 30 seconds.) So what’s the challenge?
Given two numbers, M and N, return the fraction created by dividing M into N, but only if a ‘whole’ fraction is created. Otherwise return an empty string.
(2,4) == 1/2
(3,9) == 1/3
(5,25) == 1/5
Assume, or throw an error, if the first number is larger than the second. Support from 1/1 to 1/9 for full “bonus” points. (Sorry, bonus points are not redeemable on planets with oxygen.)
Ok, get to it!