Heptane has a formula of
First find the molar mass (gram formula mass) of the molecule using the atom values and masses from the periodic table.
C has a mass of 12.01 amu (mass from the periodic table)
H has a mass of 1.01 amu
There are 7 carbon atoms and 16 hydrogen atoms in this molecule.
C 6 x 12.01 = 72.06
H 17 x 1.01 = 17.17
72.06 + 17.17 = 89.03 g/mole
Now find the percent breakdown by comparing the mass of each element to the mass of the molecule.
72.06 / 89.03 = 0.8093 or 80.9%
17.17 / 89.03 = 0.193 or 19.3%
Heptane is 80.9% Carbon and 19.3% Hydrogen.
Here is a YouTube videos on determining percent composition and gram formula mass.
I hope this was helpful.