Every rational number can be written as a repeating decimal, where from some position on the same block of digits repeats forever.
31=93=0.3333333⋯=0.3
71=999999142857=0.14285714285714⋯=0.142857
143=99999902142855=0.2142857142857⋯=0.2142857
The denominators above are made of nothing but 9s and 0s, and that pattern is exactly the standard recipe for turning a repeating decimal back into a fraction. Starting from an arbitrary fraction, that recipe is hard to apply, so the usual way to convert a fraction into a repeating decimal is repeated long division. Doing it by hand takes a lot of work, so write a program that does it for you.