When heated, water is lost from the hydrated compound. Thus, find the mass lost, and that will be equal to the mass of water that was in the compound.
27.98 g - 18.97 g = 9.01 g = mass of H2O in original sample
SnCl2 molar mass = 189.7 g/mole
mass of anhydrous SnCl2 = 18.97 g
moles anhydrous SnCl2 18.97 g x 1 mole/189.7 g = 0.1 moles
moles H2O in original sample = 9.01 g x 1 mole/18 g = 0.5 moles H2O
Multiplying both by 10 to get whole numbers gives the formula SnCl2·5H2O as the formula of the hydrated salt.
Tin(II) chloride pentahydrate