Question: how do you know what charge an element has?
Answer: To find the ionic charge of an element you'll need to consult your Periodic Table. On the Periodic Table metals (found on the left of the table) will be positive. Non-metals (found on the right) will be negative. But you need to know the specific ionic charge elments.