Source: http://www.info-mounier.fr/1nsi/seq10/Algorithmes_gloutons_exercices_correction.pdf