Firstly, look at the two compounds.
Tin is a metal. Sulfur is a non-metal. When a metal and non-metal join it is an ionic bond.
This also means you can deduct the chemical formula using this information.
Secondly, you need to find the valence number of each element as to find what ion the atom will form (how many electrons in its valence shell will it lose or gain).
For Tin, it is already given, as 4. This means Tin has 4 outer electrons, generally metals form postive ions so Tin will lose these negative electrons, it will then become and ion with a charge of 4+, Sn 4+.
Sulfur, looking at the periodic table, is in group 16, or (6A), meaning it will have 6 outer shell electrons. It will gain 2, as it easier to gain 2 than to lose 6. So it forms a negative ion or anion of S 2-.
To balance the charges when these two substances mix, you need two sulfur ions to balance the charge of the tin ion, because the tin has twice the opposing charge. You can simply swap the charges over and make this the amount of ions, then simplfy the numbers down.
So you end up with SnS2.