According to law of definite proportion:
In a compound, elements are always arranged in fixed ratio by mass.
Here, sample 1 has 23.22 g Carbon and 32.00 g Oxygen.
Converting mass into number of moles:
Molar mass of carbon is 12 g/mol and that of oxygen is 16 g/mol thus,

Similarly, number of moles of oxygen will be:

The ratio of number of moles of carbon and oxygen will be:

Therefore, formula of compound will be CO.
Sample 2:
It has 36.22 g Carbon and 48.00 g Oxygen.
Converting mass into number of moles:
Molar mass of carbon is 12 g/mol and that of oxygen is 16 g/mol thus,

Similarly, number of moles of oxygen will be:

The ratio of number of moles of carbon and oxygen will be:

The formula of compound will be CO.
Therefore, it is proved that carbon and oxygen are present in fixed ratios in both the samples.