You are part of a team developing software to help students learn basic mathematics. You are to write one part of that software, which is to display possibly improper fractions as mixed fractions. A proper fraction is one where the numerator is less than the denominator; a mixed fraction is a whole number followed by a proper fraction. For example the improper fraction 29/12 is equivalent to the mixed fraction 2 5/12. You should not reduce the fraction (i.e. don’t change 3/12 to 1/4).
Input has one test case per line. Each test case contains two integers. The denominator is in the range [1, 231 − 1]. The numerator is in the range [0, 231 − 1]. Stop if invalid input is encountered.
For each test case, display the resulting mixed fraction as a whole number followed by a proper fraction, using whitespace to separate the output tokens.
Sample Input | Sample Output |
---|---|
55 17 28 12 60 11 |
3 4 / 17 2 4 / 12 5 5 / 11 |