Check If a Given Rational No. Is Terminating or Not