$$Density = \frac{mass}{volume}$$
In this case, the mass is g and the volume is Cm. Therefore, the density is:
$$Density = \frac{g}{Cm}$$