A fraction will have a terminating decimal only if we can write the denominator as (2n x 5n) where n ≥ 0
To see why this is true......note that all terminating decimals can be written as A / 10n = A / (2 * 5)n = A / (2n x 5n) where A is the integer formed by moving the decinal point in the non-repeating decimal n places to the right.
For instance
1/4 = 1/(22 x 50) = .25 = 25 / (22 x 52) = 25 / 100
And
1/5 = 1/(20 x 51) = .20 = 20 / (22 x 52) = 20 / 100
But, note that fractions such as 1/6, 1/13, 1/23 will repeat because the denominators cannot be factored solely in terms of 2 and 5.
