1 mole CO equivalent to 6.02x10^23 molecules of CO contain 6.02x10^23 atoms of Oxygen.
So 6.02x10^24 CO molecules contain 6.02x10^24 atoms of O which is equivalent to 10 gm-atoms of oxygen.
Since Oxygen is diatomic, 10 g-atom = 1/2x10 g-molecule of Oxygen = 5 gram-molecule of O2 = 5 grams of O2 molecule.
Or in simple terms,
6.02 x 10²³ molecules of CO = 1 mole of CO
6.02 x 10²⁴ molecules of CO = 10 mole of CO
= 10 g atoms of O = 5 g molecules of O₂