Well, how would you do them on paper?

If a/b=14/20 and c/d=16/36, what's p/q (I got 103/90)? Show your working, and we can help you translate that working into an algorithm. Also show how far you got and where you're stuck, and we can help you with the next step.

Same goes for the second one. This one's a lot more interesting! Seems the key to this is to start with the long division algorithm you followed way back, you know where you write it out and solve it as follows:

Code:

14...etc
----------
7)1.0000000
7
---
30
28
--
2...etc

As you perform a couple of example divisions on paper, e.g. 1/7 and 3/8, can you see anything that your program should look for, in order to determine (a) if there is a loop and if so where from; (b) if the decimal expansion terminates.