Source: https://mathsamatt.com/fichiers/3eme/cours/PROG3-2011-2012.pdf