A fraction, reduced to lowest terms, will correspond to a terminating decimal if and only if the prime factorization of the denominator has only powers of 2 and 5. If there are any other factors it will be an infinitely repeating decimal.
So, the condition required for a rational number to have a terminating decimal expansion is that when the number is in its simplest form then its denominator should be in the form of 2^m * 5^n ( where m and n are any whole number ).