Calculating the mass of 1 molecule of ammonia:
Mass = ( Number of hydrogen atoms x Mass of hydrogen atom) + ( Number of nitrogen atoms x Mass of nitrogen atoms)
Mass = ( 3 x 1 ) + ( 1 x 14) = 17
Calculating percentage by mass
Percentage by mass of nitrogen = ( Mass of nitrogen atom / Mass of ammonia molecule ) x 100 = ( 14 / 17 ) x 100 = 82%