Source: http://mathsfg.net.free.fr/algorithmique/algorithmiquecours2nde.pdf