Check if a Given Rational Number is Terminating or Not