Aniline, consists of C, H, and N. Combustion of such compounds yields CO2, H2O, and N2. If the combustion of 9.71 mg of aniline yields 6.63 mg H2O and 1.46 mb N2, what is the empirical formula? What is the molecular formula of a compound with the molecular weight of 372.504 amu?

First off, would this be written like:
2C6H7N + Fuel -----> 12CO2 + 7H2O + N2 ...or no?

Yes, or more accurately

4C6H7N + 31O2 ==> 24CO2 + 14H2O + 2N2
BUT you don't need the equation.

Convert 6.63 mg H2O to mg H.
You have 1.46 mg nitrogen ATOMS.
Calculate mg C from 9.71-mg N - mg H.

Convert mg C to moles.
Convert mg H to moles.
Convert mg N to moles.

Now you want to determine the ratio of these elements to each other in small whole numbers. The easiest way to do that is to divide the smallest number by itself. Then divide the other numbers by the same small number. Round to whole numbers. That should give you the empirical formula.
Is the molar mass of 372.504 part of the same problem?

Why did you convert grams of H2O into grams of Nitrogen, could you choose any other element to convert it into instead?

@DrBob222

Yes it is part of the same problem

I'm a little confused about how to convert 6.63 mg H2O to mg H. And calculating mg C as well.

6.63 mg H2O x (2 moles H/1 mole H2O)x (1 mole H2O/18.015 g H2O) = 0.736 g hydrogen.

1.46 mg N
mg N + mg H = 1.46 + 0.736 = 2.196 mg and subtract that from the sample mass = 9.71 mg and we have 9.71-2.196 = 7.51 mg C.

Now convert mg of each to moles and calculate the ratio.

After you have the empirical formula, (of course you already know it is C6H7N), determine the empirical mass. That will be, of course, 6*12 + 7*1 + 1*14 = ??
You want to calculate how many of those "empirical formula units" are in the molecule that has a molar mass of 372.504; therefore, 372.504/empirical mass = some number, then round to a whole number. That whole number, which I will call x, will be the number of empirical units that are in the total molecule and you will write the molecular formula as (C6H7N)x. You may then multiply everything inside the parentheses by the number x and you will have the molecular formula.

Shouldnt that 6.63 mg be converted to grams before using that formula to get g hydrogen?

Yes and no. Yes, you can convert 6.63 mg to grams, go through the calculation and convert grams back to mg but I didn't convert in the first place so I had no reconverting to do. Another way is to convert 6.63 mg to grams, go through the calculation and have the answer for H in grams. Do the same for nitrogen and get the answer in grams. Finally, convert the 9.71 mg to grams, then all of the answers for H, C, and N are in grams. None of that changes the ratio; therefore, I just left everything in mg.