The thing to remember about atoms is that they are electrically neutral as long as
#color(blue)(ul(color(black)("no. of protons " = " no. of electrons")))#
For any given neutral atom, the number of protons located inside the nucleus will be equal to the number of electrons that surround the nucleus.
Now, when the atom loses electrons, the balance is disturbed because the number of electrons, which are negatively charged, no longer balances the number of protons, which are positively charged.
When this happens, the atom becomes a positive ion, or cation. This implies that it carries a positive net charge that is equal to
#color(blue)(ul(color(black)("net charge" = "no. of protons " - " no. of electrons")))#
Similarly, when a neutral atom gains electrons, it becomes a negatively charged ion, or anion. This implies that it carries a negative net charge.