What is the molecular formula of sugar?

It depends on the kind of sugar you are talking about. If you are talking about glucose or fructose, the molecular formula is C6H12O6 (glucose and fructose only differ in structure but have the same formula). Sucrose, which is common table sugar, has the molecular formula C12H22O11.

Scientifically, the word "sugar" is used for any mono- or di-saccharide. Sugar added in food is called sucrose. Sugar naturally found in fruit is called fructose.