We're asked to find the total number of atoms in #145# #"mg"# of caffeine, with its given chemical formula.
Let's first do a simple conversion from milligrams to grams, because we'll be using molar mass calculations in a bit:
#145cancel("mg")((1"g")/(10^3cancel("mg"))) = 0.145"g"#
Now, let's calculate the molar mass of caffeine, using the molar masses of the individual elements and how many of each element is in the compound:
#overbrace((8)(12.01"g/mol"))^"C" + overbrace((10)(1.01"g/mol"))^"H" + overbrace((4)(14.01"g/mol"))^"N" + overbrace((2)(16.00"g/mol"))^"O"#
#= color(red)(194.22# #color(red)("g/mol"#
Now, let's convert the given mass (#0.145# #"g"#) to moles using this molar mass:
#0.145cancel("g C"_8"H"_10"N"_4"O"_2)((1"mol C"_8"H"_10"N"_4"O"_2)/(color(red)(194.22)cancel(color(red)("g C"_8"H"_10"N"_4"O"_2))))#
#= 7.466 xx 10^-4# #"mol C"_8"H"_10"N"_4"O"_2"#
Now, using Avogadro's number, let's convert this mole number to the number of caffeine molecules:
#7.466 xx 10^-4#
#cancel("mol C"_8"H"_10"N"_4"O"_2)((6.022xx10^23"molecules C"_8"H"_10"N"_4"O"_2)/(1cancel("mol C"_8"H"_10"N"_4"O"_2")))#
#= 4.496 xx 10^20# #"molecules C"_8"H"_10"N"_4"O"_2#
In one molecule of caffeine, there are #8 ("C") + 10 ("H") + 4 ("N") + 2 ("O") = color(green)(24# #sfcolor(green)("atoms"#, so therefore,
#4.496 xx 10^20# #cancel("molecules C"_8"H"_10"N"_4"O"_2)((color(green)(24"atoms"))/(1cancel("molecule")))#
# = color(blue)(1.08 xx 10^22# #color(blue)("atoms"#
rounded to #3# significant figures, the amount given in the problem.
Therefore, there are #color(blue)(1.08 xx 10^22# atoms in #145# #"mg"# of caffeine.