Empirical and Molecular Formulae
Yes they make sense but the same molecular formula can represent different compounds, for the first case $\ce{C3H6O3}$ may rappresent:
Glyceraldehyde:
or lactic acid (and its optical isomers):
$\ce{C4H8O4}$ leads to even more possibilities see the three different tetrose

Generally these compounds may be created when the sum of the formal charges of each atom in the molecular formula is equal to zero. Oxygen, hydrogen normally have formal charge of -2 and -1 carbon +4 so:
$$-2\times n + (-1 \times n \times 2) + (+4 \times n)=-4\times n +4\times n=0$$