the formula:
[tex]C_{a} H_{2a+2-2x}[/tex]
where
a - number of the carbon atoms
x - number of double bonds
We take as a example the hydrocarbon with 4 carbon atoms
x = 1 → [tex]C_{4} H_{2*4+2-2*1}[/tex] → [tex]C_{4} H_{8}[/tex]
x = 2 → [tex]C_{4} H_{2*4+2-2*2}[/tex] → [tex]C_{4} H_{6}[/tex]
x = 3 → [tex]C_{4} H_{2*4+2-2*3}[/tex] → [tex]C_{4} H_{4}[/tex]