How to determine the molecular formula of a compound given its molecular mass and mass percentage contribution of the involved elements? Hydralazine is a drug used to treat heart disease. It is $59.99\%$ carbon, $5.03\%$ hydrogen, and $34.98\%$ nitrogen and has a molecular mass of $160.178$.

What is the molecular formula for hydralazine?

I did:
\begin{align}
59.99~\ce{C}/12.011&amp;=4.994\\
5.03~\ce{H}/1.01&amp;=4.9801\\
34.98~\ce{N}/14.007&amp;=2.4973.
\end{align}

Then divided all $3$ by $2.4973$, and got 2 carbon, 2 hydrogen, and 1 nitrogen atoms i.e. $\ce{C_2H_2N}$. The online homework said that the stoichiometry was wrong. I don't know what I did wrong.
The percentages are based on the molar mass. You have to multiply the percentages with the molar mass and divide by the mass of the atoms.

\begin{align}
\ce{C}:&amp;&amp; \frac{0.5999 \cdot 160.178}{12.011} &amp;\approx 8\\
\ce{H}:&amp;&amp; \frac{0.0503 \cdot 160.178}{1.01} &amp;\approx 8\\
\ce{N}:&amp;&amp; \frac{0.3498 \cdot 160.178}{14.007} &amp;\approx 4\\
       &amp;&amp; \implies \ce{C8H8N4}\\
\end{align}