Note down the formula below
[tex]\boxed{\sf Mass\%\;of\; element=\dfrac{Mass\:of\:the\: element}{Mass\;of\:the\: compound}\times 100}[/tex]
Mass of the compound
[tex]\\ \sf\longmapsto 32+2=34g[/tex]
Mass % of Hydrogen:-
[tex]\\ \sf\longmapsto \dfrac{2}{34}\times 100[/tex]
[tex]\\ \sf\longmapsto \dfrac{1}{17}\times 100[/tex]
[tex]\\ \sf\longmapsto 5.8\%[/tex]
Mass % of Oxygen:-
[tex]\\ \sf\longmapsto \dfrac{32}{34}\times 100[/tex]
[tex]\\ \sf\longmapsto \dfrac{16}{17}\times 100[/tex]
[tex]\\ \sf\longmapsto 94.2\%[/tex]