Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I would like to create a program with the windows form application in c # that will convert a decimal number into a fraction.
Help me! please!!

What I have tried:

I have no idea how to do it
Posted
Updated 16-Apr-18 6:09am
Comments
Ravi Bhavnani 16-Apr-18 12:02pm    
Sorry, we're not here to do your work. If you have specific question, feel free to ask and we'll do our best to try and help.

/ravi
Richard MacCutchan 16-Apr-18 17:22pm    
Forget Windows Forms, and just think about how to convert a decimal number into a fraction.
I know is too late, but if you need, I can teach you how to do it.

1 solution

It's not difficult at all: 12.3 is just 12 3/10 and 12.5 is just 12 5/10

It's if you want it as a irreducible fraction that it gets more complex, i.e. 12.3 is just 12 3/10 but 12.5 is 12 1/2
This is your homework, so I'll give you no code, but see here: Irreducible fraction - Wikipedia[^] - it may give you some ideas.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900