Winner: Ian D. Scott's answer, by one byte (48 bytes)! Superb!
Your program must accept input from a fraction that can be simplified, then simplify it.
Rules:
- If the fraction is already in its most simplified form, you must inform the user
- No built-in functions to do this
- The user must type the number at some point, however the method the program reads it does not matter. It can be with stdin, console.readline, etc. As long as the user types
9/18
(for example) at some point, it is valid - Output must be done with stdout, console.writeline, etc...
- The fraction will be put in as
x/y
, and must output asa/b
- The fraction must output the most simplified form. For example, 8/12 -> 6/9 is not valid, the only valid solution is 2/3.
- This contest ends on August 9th, 2014 (7 days from posting)
- This is a code-golf question, so the shortest code wins