Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite0
How to convert decimal number in fraction in CPP?
eg:- how to convert any number X in the form p/q?
1 Réponse
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.