We can use a simple equation to solve this problem.
d = m/v
Where d is the density, m is the mass and v is the volume.
d = 7.87 g/cm³
m = ?
v = 3.0 cm³
By applying the equation,
7.87 g/cm³ = m / 3.0 cm³
m = 7.87 g/cm³ x 3.0 cm³
m = 23.61 g
Hence, the mass of 3.0 cm³ of iron is 23.61 g.