The cartilaginous diaphragm when contracts, increases the surface area for lungs which spreads, thereby, reducing the air pressure in it. The pressure of air at the nostrils is more and hence the air flows from higher pressure area to lower pressure area i.e. lungs. This is called inhalation. When the diaphragm relaxes, it pushes the lungs thereby increasing the pressure on them and the surface area reduces and hence the pressure of air in the lungs is more which is forced/given out from the nostrils. This is called exhalation.
