Source: https://cedric.cnam.fr/~lamberta/enseignements/C/corrections/01/correction_tp1.pdf