CCC '02 S2 - Fraction Action


Submit solution

Points: 1
Time limit: 0.5s
Memory limit: 256M

Problem type
Allowed languages
Python
Canadian Computing Competition: 2002 Stage 1, Junior #4, Senior #2

Many advanced calculators have a fraction feature that will simplify fractions for you.

You are to write a program that will accept for input a non-negative integer as a numerator and a positive integer as a denominator, and output the fraction in simplest form. That is, the fraction cannot be reduced any further, and the numerator will be less than the denominator. You can assume that all input numerators and denominators will produce valid fractions.

Sample Input 1

28
7

Sample Output 1

4

Sample Input 2

13
5

Sample Output 2

2 3/5

Sample Input 3

0
7

Sample Output 3

0

Sample Input 4

55
10

Sample Output 4

5 1/2

Comments

There are no comments at the moment.