A 23.86 g sample of impure magnesium carbonate was heated to complete decomposition

according to the equation
MgCO3(s) → MgO(s) + CO2(g).
After the reaction was complete, the solid
residue (consisting of MgO and the original
impurities) had a mass of 16.41 g. Assuming that only the magnesium carbonate had
decomposed, what was the percent of magnesium carbonate in the original sample?
Answer in units of %.

This is done the same way as the Ag2CrO4 problem you had earlier.

MgCO3 + impurities ==> MgO + impurities + CO2
So you have the initial mass and the final mass. The difference must be the loss of CO2. Convert mass CO2 to mass of PURE MgCO3 to start.
Then % MgCO3 = (mass PURE MgCO3 to start/mass impure MgCO3)*100 = ?
Post your wor if you get stuck.