Use the rule of 13 - the formula of a compound is a multiple n of 13 (the molar mass of CH) plus a remainder r. For O, add O and remove CH₄ and for N, add N and remove one CH₂.
84 ÷ 13 = 6r6, the integer equals the number of carbon atoms and the integer plus the remainder equals the number of hydrogen atoms, so possible formula is C₆H₁₂.
M(C₆H₁₂) = 6 · 12,00 + 12 · 1,008 = 84,096.
Add one oxygen atom to molecular formula: C₅H₈O.
M(C₅H₈O) = 5 · 12,00 + 8 · 1,008 + 15,995 = 84,059, not.
Add one nitrogen atom to molecular formula: C₅H₁₀N.
M(C₅H₁₀N) = 5 · 12,00 + 10 · 1,008 + 14,003 = 84,083, not.
If we add nitrogen and oxygen mass will be lower than 84,095, so molecular formula is C₆H₁₂.