Check If a Given Rational Number Is Terminating or Not