The molecular mass of the compound CO2 is calculate by simply taking the number of atoms of each element and multiplying it by the molar mass of the element on the periodic table.
C = 1 • 12.0 g/mol
O2 = 2 • 16.0 g/mol = 32.0 g/mol
CO2 = 12.0 + 32.0 = 44.0 g/mol.
The formula mass of CO2 is 44.0 g/mol.