Calculate the percentage composition of the compound

6 g of a sample of a compound having boron and oxygen was found by analysis to contain 2 g of boron and 4 g of oxygen. Calculate the percentage composition of the compound.

Mass of compound = 6 g
Mass of boron in the compound = 2 g
Mass of oxygen in the compound = 4 g
Percentage of Boron = Mass of Boron / Mass of compound x 100 = 2/6 x 100 = 33.33%
Percentage of Oxygen = Mass of oxygen / Mass of compound x 100 = 4/6 x 100 = 66.67%