u also have to take into cosideration, the stiochiometry! and most of the times the mass or number of moles is asked because molar mass is given..unless u have an unknown sample where u have to fine the molar mass to know the formula of your sample
good luck:)