1. Mass no.= protons+ neutrons,
Therefore, mass no. of sodium = 11 + 12 = 23
2. Total no. of electrons in a neutral sodium atom (has not reacted with anything, thus has not lost any electrons, thus is neutral) = Atomic no. = electron no. = 11
3. So as mass no. of magnesium is 24, and mass no. = protons+neutrons, and no. of protons is 12, then no. of neutrons= atomic no. - protons = 24-12= 12
4. Atomic no. = no. Of electrons= 13
5. Mass no. = protons+neutrons= 31
No. Of neutrons=16
Therefore, no. Of protons= Mass no. - neutrons= 31-16=15
Also- no. Of protons=no. Of electrons= 15 (another way to solve)