Percent to mass
Mass to mole
Divide by small
Multiply 'til whole
Assume 100 g of substance, then 82.2 g N and 17.8 g H.
82.2 g N * (1 mol/14.01 g N) = 5.86 mol N
17.8 g H * (1 mol/1.01 g H) = 17.6 mol H
Divide by the smallest mole
17.6 H / 17.6 = 1 H
5.86 N / 17.6 = 1/3 N
Multiply to make whole number ( x3 in this case)
3 x 1 H = 3H
3 x 1/3 N = 1 N
NH3