Question: how to calculate the percent composition by mass of each element?
Answer: Find the molar mass of all the elements in the compound in grams per mole.
Find the molecular mass of the entire compound.
Divide the component's molar mass by the entire molecular mass.
You will now have a number between 0 and 1. Multiply it by 100% to get percent composition.