$\pu{12 g}$ of $\ce{C}$ reacts with $\pu{64 g}$ of $\ce{O2}$ to give a mixture of $\ce{CO}$ and $\ce{CO2}$. Find amount of $\ce{CO}$ and $\ce{CO2}$ at the end of reaction.
What I tried was to let x moles of carbon react to give $\ce{CO2}$ and y moles react to give $\ce{CO}$.
$$\ce{ \underset{x}{C} + \underset{x}{O2} -> \underset{x}{CO2}}$$ $$\ce{\underset{y}{2C}} + \underset{y/2}{\ce{O2}}\ce{ -> \underset{y}{2CO}}$$
Solving for $x + y = 1$ and $x + 0.5y = 2$ , we get $x=3$ and $y= -2$ which is meaningless.
I followed the method used in this answer.
Can anyone tell me where I went wrong?