Your unknown gas is ethane and its molecular formula is
So, you know that you're dealing with a hydrocarbon, which is a compound that contains only carbon and hydrogen. This means that you can use the percentage of carbon to determine the percentage of hydrogen in the compound
Before determining the compound's molecular formula, you're going to have to determine its empirical formula. To make the calculations easier, assume that you have a 100-g sample of your unknown gas.
Since you know the percent composition of the compound to be 80 g carbon and 20 g hydrogen, you can use the molar masses of the two elements to determine how many moles of each you'd get in that sample.
Divide these two numbers by smallest one to determine the mole ratio that exists between carbon and hydrogen
This means that your empirical formula will be
In order to determine the value of
Now determine the value of
Therefore, the molecular formula for your compound is