The QBasic Forum      Other Subforums, Links and Downloads
 Return to Index  

Decimal to fraction converter

March 10 2009 at 6:56 PM
Anonymous  (no login)

Write a program that converts a number entered in decimal format to a fraction that most closely approximates the entered number. The fraction must be in lowest terms and must equal the entered number when rounded back.

For example if 1.23456 is entered, the program should respond with the fraction 1879/1522.

Evaluate the fraction and you get 1.23455978... which equals the entered number when rounded back to 5 decimal places.

 
 Respond to this message   
Responses