How many grams of ammonia is formed when 8 g of nitrogen is reacted with 10 g of hydrogen

This is a limiting reagent(LR) problem.

N2 + 3H2 ==> 2NH3

mols N2 = grams/molar mass = 8/28 = approx 0.29 but you need to do all of these calculations yourself and do them more accurately than my estimates.

mols H2 = 10/2 = 5

Convert mols N2 to mols H2. That's 0.29 mols N2 x (3 mols H2/1 mol N2) = 0.29 x 3 = approx 0.9. You have that much H2; therefore, N2 is the LR.

Convert mols N2 to mols NH3. That's about
0.9 x (2 mols NH3/1 mol N2) = about 1.8 mols NH3.
Now convert that to grams NH3. g = mols x molar mass.