In the periodic table of elements, you'll see each element's atomic weight listed. Scientists use atomic mass units (amu) to describe the mass of atoms, so think of atomic weights in terms of amus. Avogadro's constant -- 6.02 x 10^23 -- describes the number of atoms in a mole of an element. Weighing a sample of an element gives you its mass in grams. If you have all three pieces of information -- atomic weight, grams and Avogadro's number -- you can calculate the number of atoms in the sample.
TL;DR (Too Long; Didn't Read)
To calculate the number of atoms in a sample, divide its weight in grams by the amu atomic mass from the periodic table, then multiply the result by Avogadro's number: 6.02 x 10^23.
Set up Equation
Express the relationship of the three pieces of information you need to calculate the number of atoms in the sample in the form of an equation. Scientists express atomic weights in terms of grams per mole, so the resulting equation looks like this: atomic weight expressed in atomic mass units = grams/mole. In scientific notation, it would appear like this: u = g/mole.
Find Atomic Weight
Look up the sample's atomic weight on a periodic table of the elements. For example, boron has an atomic weight of 10.811 atomic mass units which you could also express as 10.811 grams per mole of the element. Plugging that figure into the above equation would look like this: 10.811 = g/mole.
Solve for Unknown Quantity
Solve the equation for the unknown quantity; if u = g/mole and you have a number for u and g, then the number of moles is your target. Multiply everything through by the divisor to isolate the unknown quantity and you will reach an equation that looks like this: mole = g ÷ u, where g equals the sample's weight in grams and u equals the element's atomic weight in atomic mass units.
Determine Moles from Grams
Divide the grams of your sample by its atomic weight to derive the number of moles the sample contains. If your sample of boron weighed 54.05 g, your equation would look like this: mole = 54.05 ÷ 10.811. In this example, you would have 5 moles of boron. In your calculation
Find Number of Atoms
Multiply the number of moles in the sample by Avogadro's number, 6.02 x 10^23, to derive the number of atoms in the sample. In the given example, multiply Avogadro's constant by 5 to discover that the sample contains 3.01 x 10^24 individual boron atoms.
Check your work to ensure that it makes sense. Negative numbers, small numbers and numbers that do not seem to fit with the sample size mean a mathematical error. Keep an eye on your exponents when you convert your answer into scientific notation; note how the exponent in the example changed from 10^23 to 10^24.