Water (H2O) throught roots, sunlight reaches chloroplast in the leaves where it converts H2O into O2 and passes ATP (form of energy) to the calvin cycle, which undergoes reactions to convert CO2 (enters through leaves) to glucose, with the addiction of hydrogen.
H2O+CO2=GLUCOSE+O2
O2 waste product (we can breath it thought :D)
the glucose contains energy and is stored as starch; a polysaccharide made of disaccharide chains of maltose (glucosex2).