TORONTO KIDS COMPUTER CLUB | PMCA Friday 19:00 Python Homework 20.08.21.
18184
post-template-default,single,single-post,postid-18184,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.8.0,vc_responsive

PMCA Friday 19:00 Python Homework 20.08.21.

25 Aug PMCA Friday 19:00 Python Homework 20.08.21.

Question:
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

No Comments

Sorry, the comment form is closed at this time.