Try this problem, useful for the Physics Olympiad Problem based on total charge of a sphere.

The Problem:

Suppose a charge (Q) is distributed within a sphere of radius (R) in such a way that the charge density (\rho(r)) at a distance r from the centre of the sphere is
$$ \rho(r)=K(R-r) \hspace{2mm }for\hspace{2mm} 0<r<R$$
$$ 0 \hspace{2mm} for \hspace{2mm} r>R$$

Determine the total charge (Q).
Solution:

Let us consider a thin spherical shell of radius (r) and thickness (dr). Charge within it is (\rho(r).4\pi r^2dr). Therefore, the total charge $$ Q=\int_{0}^{R}\rho(x).4\pi r^2dr$$$$=4\pi K\int_{0}^{R}(R-r)^2dr$$$$=\pi KR^4/3$$