You know how many moles of carbon you have; you can calculate it from the mass of the carbon in the sample. If the the molecular formula for the compound is CX4, then you know the mole ratio of C and X is 1:4.
Can you get the answer from there?
As the question asks only for the number of moles of X, the mass of the sample is actually irrelevant unless you are asked to identify element X.