H has an atomic mass of 1, so H2 = 2
O has atomic mass of 16
16+2=18, which is the relative atomic mass of 1 water molecule (relative to a carbon 12 atom).
We must also know the mass of water, lets say 50g.
We can find the number of moles of water using the equation:
Number of moles = mass/mass of 1 mole
number of moles = 50/18 = 2.77777777777moles
Each mole of any substance contains 6.022x1023 molecules. So if we multiply 2.77777 by this number (avogadro's constant) then we get the number of molecules, =1.6727777x102
Now, since there are 3 atoms present in each water (2 hydrogen, 1 oxygen), we can find the total number of atoms by multiplying this answer by 3, = 5.018333x1024
If you mean the number of atoms in a single molecule, then you just need to know the molecular formula. I was assuming you meant for an amount of the molecule.