Answer : The atoms gain or loose electrons to achieve a stable electronic configuration.
Explanation :
According to Octet rule :
In order to attain stability the atoms tends to have eight electrons in its valence shell which can be obtained by either by sharing of electrons of complete transfer of electrons.
The tendency of atoms to attempt to get a noble gas configuration that is eight valence electrons is said to be octet rule.
The atoms gain or loose electrons to achieve a stable electronic configuration.
An ion is formed when an atom looses or gains electron.
When an atom looses electrons, it will form a positive ion known as cation.
When an atom gains electrons, it will form a negative ion known as anion.
For example : As we know that the sodium has one valence electron, so if giving it up then the result in the same electron configuration as the neon and chlorine has seven valence electrons, so if it takes one it will have eight and the result in the same electronic configuration as the argon that means to achieve stable electronic configuration, the atoms lose or gain electrons.
Hence, the atoms gain or loose electrons to achieve a stable electronic configuration.