Hi,
Let x represent the # of carbon atoms. then (36-x) would represent the # of oxygen atoms
Question states

cross multiply to solve
2x = 36-x
3x = 36
x = 12, the # of carbon atoms, therefore, 24 (36-12) would be the number of oxygen atoms
checking our answer
12/24 = 1/2