for this you have to see the molecule of sugar. and calculate number of moles.
The formula of sugar , sucrose C12H22O11 , molar mass = 342
According to above molecular formula.
Now lets calculate the number of moles in 10 grams of sugar.
Number of moles = given mass / molar mass
Number of moles = 10 /342
Number of moles = 0.02923
Now 1 molecule of sugar has = 12 carbon atoms
So 1 mole of sugar = 12 moles of carbon atoms
Number of moles of carbon = 12 x 0.02923
= 0.351 moles
Now number of Carbon atoms = number of moles of carbomson X Avogadro njmber
Number of C- atoms = 0.351 x 6.022×1023
= 2.114 x 1023