The ratios of any atoms in the molecule can be just found easily by having a look at the molecular formula of that molecule or compound.
The formula of ammonia is NH3. How many nitrogen’s are present in one molecule of ammonia? The answer is 1.
How many hydrogen’s are present? As can be seen in formula it’s 3.
Take the ratio of nitrogen to hydrogen it would be 1 is to 3.
Answer is B
I have listed other examples for more understanding. See picture attached.