Show that rational numbers correspond to decimals

Show that rational numbers correspond to decimals which are either repeating or terminating.

Hint: If q = m|n, then when dividing m by n to put q into decimal form there are at most n different remainders. Conversley, if d is a repeating decimal, then find s,t such that 10^sd - 10^td is an integer.

I took an example and understand, but don't know how to write it in a general form.

My example:

Part I

2/7

0.2857142...

7√2.000...

__-14__

**6**0

__-56__

**4**0

__-35__

**5**0

__-49__

**1**0

__- 7__

**3**0

__-28__

**2**0

__-14__

**6**....

So the my bold numbers can only be 1-6

Part II

R = 12.34545...

100R = 1234.54545...

100R - R = 1222.2

99R = (12222 / 10)

R = (12222 / 990)

Any help on writing this in a general form would be greatly appreciated.