Explain why 90% of air is concentrated in the layer closest to the earth

What is gravity? What does it do?