Molecular formula in the first place is required to understand which compound we have. We then should refer to the periodic table and find the molecular weight for each atom. Adding individual molecular weights together would yield the molar mass of a compound.
Then, dividing the total molar mass of a specific atom by the molar mass of a compound and converting into percentage will provide us with the percentage of that specific atom.
E. g., calculate the percent composition of water:
Matter cannot be created or destroyed in chemical reactions. This is the law of conservation of mass. In every chemical reaction, the same mass of matter must end up in the products as started in the reactants. Balanced chemical equations show that mass is conserved in chemical reactions.