#include <stdio.h>
#include <stdlib.h>
int fib(int n) {
if(n == 0 || n == 1) {
return 1;
} else {
return fib(n - 1) + fib(n - 2);
}
}
int fib_loop(int n) {
if(n == 0 || n == 1) {
return 1;
}
int array[n+1] {0};
array[0] = 1;
array[1] = 1;
for(int i=2; i <= n; i++) {
array[i] = array[i-1] + array[i-2];
}
return array[n];
}
int main(int argc, char const *argv[])
{
printf("%d\n", fib_loop(5));
printf("%d\n", fib(5));
return 0;
}