This algorithm decomposes a fraction which is less than one as a sum of unit fractions.
You are viewing a single comment. View All
um I think your supposed to un indent the last line to call the function???
def fraction(p,q): if p==0: print ('fini') else: n=1 k=p-q while k<0: n=n+1 k=p*n-q print (n) p=p*n-q q=q*n p = int(input('Please enter the numerator >>> ')) q = int(input('Please enter the denomenator >>> ')) fraction(p,q)
just copy and paste my code into your project :p