(n <= 2) { return 1; } int a = 1; int b = 1; for (int i = 2; i < n; i++) { int c = a + b; a = b; b = c; } return b; } 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... Fonctionnel : int fibonacci(int n) { if (n <= 2) { return 1; } return fibonacci(n, 1, 1); } int fibonacci(int n, int a, int b) { if (n == 2) { return b; } return fibonacci(n-1, b, a+b); } Focus on Functional Programming