Dividing the given percentage of C and H with their respective atomic masses and taking their ratio we get the ratio of number of atoms of the elements present in the compound.
So the ratio of number of atoms of C and H in the compound will be
Hence the empirical formula of the compound is
let its molecular formula be
So calculated value of molar mass will be
But given molar mass is
So molecular formula of the hydrocarbon is