The balanced equation for ammonia formation is:
N2 + 3H2 ---> 2NH3
First we need to figure out how many moles of hydrogen, 340 grams nets us. We can do this by dividing 340 by the molar mass of diatomic hydrogen (2.016 grams/mole). This will get us 168.651 moles.
From the chemical formula, we see that it takes 3 moles of hydrogen to produce 2 moles of ammonia. So, if we multiply the moles of hydrogen by (2/3), we can find the moles of ammonia produced.
168.651 x (2/3) = 112.43 moles of ammonia
To convert this into grams, we multiply this number with the molar mass of ammonia (which is 17.031 grams/mole)
112.43 x 17.031 = 1914.8 grams of ammonia. Or if you want to account for significant figures, 1900 grams of ammonia.