Answer: In order to write the formula of a binary molecular compound, use the prefixes to determine the subscript of each element. Write the symbols for the elements with the subscripts. Ionic and molecular compounds differ in composition—ions form ionic compounds, and molecules form molecular compounds.
In order to find a whole-number ratio, divide the moles of each element by whichever of the moles from step 2 is the smallest. If all the moles at this point are whole numbers (or very close), the empirical formula can be written with the moles as the subscript of each element.