Answer
Nonmetals tend to form anions when they react to form compounds because their valence shells are nearly full and to attain noble gas electron configurations it would be easier for them to gain electrons instead of losing them.
Work Step by Step
No explanation needed.