The percentage of elements in the compound is determined from the number of elements in the compound
Proust states the Comparative Law that compounds are formed from elements with the same Mass Comparison so that compounds have a fixed composition of elements
[tex]\tt \%A~in~A_xB_y=\dfrac{x\times Ar~A}{MW~A_xB_y}\times 100\%[/tex]
[tex]\tt \%B~in~A_xB_y=\dfrac{y\times Ar~B}{MW~A_xB_y}\times 100\%[/tex]
Example
% Lithium (Li) in Li₂CO₃(lithium carbonate)
Ar of Li = 6.941 g/mol
MW of Li₂CO₃ = 73.891 g/mol
[tex]\tt \%Li=\dfrac{2.Ar~Li}{MW~Li_2CO_3}\times 100\%\\\\\%Li=\dfrac{2\times 6.941}{73.891}\times 100\%=18.79\%[/tex]