(Reminder: #"100 gm"# is the same thing is #"100 g"#.)
First, let's calculate the moles of #CO_2# that are in #"100 g"#—to do this, we divide #"100 g"# by the mass of #1# mole of #CO_2#:
#"100 g"/(CO_2 " molar mass") = "100 g"/(12.01 + 2*16.00) =
2.27#
This means there are #2.27# moles of carbon dioxide in #"100 g"#.
We also know that for every #1# mole of carbon dioxide, there will be #1# mole of carbon in it. Just look at the formula:
#CO_2#
Therefore, there are also #2.27# moles of carbon in #"100 g"# of carbon dioxide.
Because the question has given us #1# significant figure, we'll just round it to #2# moles.
Thanks so much to @Ernest Z. for telling me I misread the question! Before editing, I gave the mass of carbon instead of the moles.