Bonjour quelqu’un pourrait m’aider pour cet exercice svp ? Merci d’avance!

Bonjour,
S = 0
N = 4
i = 0:
S = 0 - 0 + 2 = 2
i = 1:
S = 2 - 1 + 2 = 3
i = 2:
S = 3 - 2 + 2 = 3
i = 3:
S = 3 - 3 + 2 = 2
i = 4:
S = 2 - 4 + 2 = 0
Bonne journée.