+ 2

What is wrong in this code? [Solved]

Hi, this code suppose to conver a fractional decimal number to base n like (7 / 8) to base 4 with this result 0.32 but it doesn't work for other numbers like (17 / 5) to base 5 or (7 / 9) to base 3 https://code.sololearn.com/cjoH62y5RcoL/?ref=app

1st Jul 2021, 8:32 AM
Alireza Ebrahimi
Alireza Ebrahimi - avatar
1 Réponse
+ 4
I figured it out, this code works if x < y and also use round function insted of floor so it don't overflow.
1st Jul 2021, 9:15 AM
Alireza Ebrahimi
Alireza Ebrahimi - avatar