The number of moles of magnesium present in your sample can be calculated using the molar mass of the element, which tells the mass of exactly
Magnesium has a molar mass of
You can thus use the molar mass of magnesium as a conversion factor to determine the number of moles present in your sample.
#2.40 color(red)(cancel(color(black)("g"))) * "1 mole Mg"/(24.305color(red)(cancel(color(black)("g")))) = "0.098745 moles Mg"#
Since you have three sig figs for the mass of magnesium, you should report the answer to three sig figs as well
#color(darkgreen)(ul(color(black)("no. of moles = 0.0987 moles Mg")))#
Your reaction can be described by the balanced chemical equation
#2"Mg"_ ((s)) + "CO"_ (2(g)) -> 2"MgO"_ ((s)) + "C"_ ((s))#
At this point, you can use the mole ratios that exist between the chemical species that take part in the reaction to determine how many moles of carbon dioxide are needed in order for all the moles of magnesium to react and how many moles of magnesium oxide and carbon will be produced by the reaction.