0

How to convert decimal number in fraction in CPP?

eg:- how to convert any number X in the form p/q?

20th Jun 2020, 2:08 AM
Ritika Dey
Ritika Dey - avatar
1 Odpowiedź
0
Find out what is your fraction in base 10, e.g. 0.75 = 75/100, 0.085 = 85/1000 Divide both numerator and denominator by __gcd(numerator, denominator) to simplify the fraction.
20th Jun 2020, 5:02 AM
Bobby Fischer
Bobby Fischer - avatar