#include <stdio.h> int main() { int arr[100] = { 0 }; arr[0] = 0; arr[1] = 1; arr[2] = 2; int n = 0; scanf("%d", &n); int i = 0; for (i = 3; i <= n; i++) { arr[i] = arr[i - 1] + arr[i - 2]; } printf("%d\n", arr[n]); return 0; }
#include <stdio.h> int main() { int arr[100] = { 0 }; arr[0] = 0; arr[1] = 1; arr[2] = 2; int n = 0; scanf("%d", &n); int i = 0; for (i = 3; i <= n; i++) { arr[i] = arr[i - 1] + arr[i - 2]; } printf("%d\n", arr[n]); return 0; }