S + O2 → SO2
z / (32.0655 g S/mol) x (1 mol SO2 / 1 mol S) x (64.0638 g SO2/mol) = (1.9979 z) g SO2
C + O2 → CO2
(9.0-z) / (12.01078 g C/mol) x (1 mol CO2 / 1 mol C) x (44.00964 g CO2/mol) = (32.9776 - 3.66418 z) g CO2
Add the two masses of SO2 and CO2 and set them equal to the amount given in the problem:
(1.9979 z) + (32.9776 - 3.66418 z) = 27.9
Solve for z algebraically:
z = 3.0 g S