n^2=(p/q)^2=k,so p=q(k)^1/2. If n^2 is an integer, then, k is an integer. Because integer=integer*integer, if p and q are non-zero integers, (k)^1/2 must be an integer. So p is devisable by q, so n is an integer.
With the same method, if n^3 is an integer, n is an integer.
n^2 = p^2 / q^3 = p/ q * p / q, if p/q is not an integer then p/q * p/q is not an integer as well, but since p/q * p/q is an integer then that means p/q must be an integer;