Water + carbon dioxide ----> glucose + oxygen
OR
6H2O + 6CO2 ----> 6C-12H-6O + 6O2
Look at the reactants (left side), and then look at the products (right side). You'll see that in the reactants, there are a total of 12 hydrogen atoms and a total of 18 oxygen atoms. There are also 6 carbon atoms.
As you can see, the glucose has 6 carbon atoms (that's all of the carbon atoms), 12 hydrogen atoms (that's all of the hydrogen atoms), and it also uses 6 oxygen atoms. So, then, that's the glucose! All that's left are oxygen atoms!
As you can see, there's also some oxygen in the list of products. Well, since 6 were used for the glucose, there's only 12 left. We have 6 oxygen atoms, which is 12 oxygen atoms total.
There you go!