Apply shell theorem the total charge upto distance r can be calculated as followed dq=4πr2⋅dr.ρ =4πr2⋅dr⋅ρ0[45−Rr]=4πρ0[45r2dr−Rr3dr]∫dq=q=4πρ0∫0r(45r2dr−Rr3dr)=4πρ0[453r3−R14r4]E=r2kq=4πε01r21⋅4πρ0[45(3r3)−4Rr4]E=4ε0ρ0r[35−Rr]