Hello, Abby,
Make a table as below to keep track of the numbers. I've got the two elements and have entered their molar masses (g/mole) along with their percentages of the sample. We calculate the mass of each element
using the percentage value, assuming that the entire 140g is just C and H. Then divide the masses by the molar masses for both elements. This will tell us the number of moles we have of each. [Keep track of the units and you'll see that for carbon, the grams cancel and leave just moles (123 grams)/(12 grams/mole) = 10.283 moles C. [I'm ignoring sig figs until the end. We have 4 sig figs in the data and I'll make any needed modifications to the final numbers.]
The answer to Part B is then 10.28 moles of C and 16.60 moles of H.
Your question does not show a "Part A." If there is a Part A, it might be related to determining the empirical formulas for the compound that was isolated. The ratio of the two mole numbers for C and H will give us that. The ratio of C to H is 0.6194. In other words, there is 0.6194 atom of Carbon for every Hydrogen. There is no such thing as 0.6194 of an atom, unless you are working with those crazy scientists at the Large Hadron Collider. For the chemists, it is important to find the nearest set of whole numbers that have that ratio. I notice that if I multiply the carbon atom count by 5 or 8, I get numbers close to 3 and 5.
So let's multiply using both numbers to see both empirical formulas: C3H5 and C5H8. (I also multiply the H atom which is set to "1" in the 0.6194 ratio)
I hope this helps,
Bob