D=m/v, d*v=m, m/D=v
This is super basic algebra/arithmetic.
2=8/4, 2*4=8, 8/2=4. Same exact thing. You should do some math review.
The g/cm3 = g/ml is correct if you are talking about water, or dilute solutions in water where you assume the density of the solution is the same as water (as water is defined as ~1g/cm3, and one mililiter of water weighs 1 gram).