check the correctness of the relation:
density = 3g/4 pi r G , where the letters have their usual meanings.
we have
ρ = (3g / 4.r.G)
here,
the dimensions of LHS is
= [ML-3]
the dimensions of RHS will be
= [LT-2] / { [L] . [M-1L3T-2] }
= [ML-3]
so,
as dimensions of LHS = dimensions of RHS
the above equation is dimensionally correct.