1. ## school project help

for my shcool project, i am supposed to write a console application program where you can enter a fraction in the form of n/d (numberator/denominator). then when you enter that, the program is supposed to divide the numerator by the denominator. then the prog should give you the quotient, but if it is a repeating decimal (i would just assume that anything above 8 decimal places is repeating) the program is supposed to show the repeating quotient as follows. lets say you typed in one third which is a repeating .3
it should display it as .(3)

1/3 [ENTER]
.(3)

how do you get the string input in the beginning to recognize n/d as two integers and then how do you get it to display a repeating decimal like .(3) I'm not sure how to get it to display it with the decimal point and then the parenthesis

now im tired from typing such a long thread. i feel like a noob

2. in your shoes, i would eat up the n/d with fgets and parse it into two strings, n and d - then use atoi to convert them to integers

the repeating decimal place will be tricky to deal with, but sprintf and %f will likely be your friend in this

3. I feel like I recognize this question from another post somewhere on these boards.....possibly same class?

Anyway, just to clarify:
http://cboard.cprogramming.com/annou...ouncementid=51
See #9

4. repeating decimals wouldn't be hard and you could prove it not just out 8 decimals. If your remainder after division stays the same twice in a row it is repeating
1/3

10/3 = 3 remainder 1 carry decimal 10 10/3 remainder 1

5. Originally Posted by linuxdude
repeating decimals wouldn't be hard and you could prove it not just out 8 decimals. If your remainder after division stays the same twice in a row it is repeating
1/3

10/3 = 3 remainder 1 carry decimal 10 10/3 remainder 1
its not nessecarily twice in a row; for example what about 1/17?

6. haha yeah, you recognize it alright! Joeshmoe1337 is my classmate and best friend, we had no idea we were both posting the same thing lol. don't worry, the project is totally extracurricular, no grades involved

7. what about 1/ 17 do you mean the double 8 in it
Code:
`0.058823529`
the numbers are the same but 150/17 then the next 8 is 140/17 different remainers

8. Originally Posted by linuxdude
what about 1/ 17 do you mean the double 8 in it
Code:
`0.058823529`
the numbers are the same but 150/17 then the next 8 is 140/17 different remainers
i mean your statement that when you see the same remainder twice in a row, you have found a repeater. 1/17 does repeat, but it never has the same remainder two times in a row (right next to eachother).

9. oh whoops I forgot about more than one digit! Oh well. I forgot about fractions like 12344/9999 I was thinking like 2/9