Properly, your formula should read
$g(r) = \frac{4\pi G}{3\color{blue}{(r+r_c)^{2}}}[ \int_{0}^{r}{\rho}(r)r^{2}.dr +F ]$
where your radial distance (which is the argument in the inverse square law) is measured from the center of the shells and thus includes the core radius $r_c$.
Otherwise your approach seems correct.