sqrt(r) = p/q where p/q is reduced

r = p^2/q^2

r*q^2 = p^2 therefore, r divides p

so define p = c*r

r*q^2 = (c*r)^2 = c^2*r^2

q^2 = c^2*r therefore, r divides q also

since r divides p and q, p/q is not reduced and we have a contradition so sqrt(r) is irrational.

Now my question is, assuming the above is correct, why does this work for prime r and not, say, r = 4.