To do this problem, we must first look at the balanced chemical equation for the decomposition of potassium chlorate:
2KClO3 --> 2KCl + 3O2
We can take the given amount of grams, and use the molar mass of KClO3 to convert to moles. Then, we can use the stoichiometric ratios to relate moles of KClO3 to moles of O2.
(39.09)+(35.45)+(3*15.99)= 122.51 g/ mol = molar mass of KClO3
45.8 g KClO3/ 122.51 g/ mol KClO3 = .374 moles KClO3
.374 mol KClO3 *(3 moles O2/2 mol KClO3)= .560 moles O2
Once we have moles of O2, we can convert to grams of O2.
(2*15.99)= 31.98 g/mol = molar mass of O2
(.560 moles O2) (31.98 g/mol)= 17.91 g O2
Hope this helps :)