Nice! Well done! 2 atoms of C weigh $$2 \times 12 = 24 \, \mathrm{amu}$$. This is exactly the mass of an Mg atom.