Step 1 - Understanding the general molecular formula for an alkane
All akanes can be reduced to a general formula that relates the number of H atoms to the number of C atoms. This general formula is:

What this formula means is that, if the number of C atoms in the alkane is n, then the number of H atoms will be 2n+2. This is a fixed relation and we can use it to discover the molecular formula for any alkane.
Step 2 - Applying the formula for 7, 8, 9 and 10 C
Since we have a formula relating the number of H to the number of C, we just need to substitute n for the number of C in each case:
