Respuesta :
Answer:
Fn=(Fn−1+Fn−2) F n = ( F n − 1 + F n − 2 ) , where n >1.
Explanation:
Answer: Here is the solution in C. This works programmatically. Feel free to alter it if there are any garbage collection issues.
Explanation:
#include <stdio.h>
int fib(int num) {
if (num <= 0) return 0;
else if (num == 1) return 1;
int fst = 0;
int snd = 1;
int sum = fst + snd;
for (int n = 0; n < num; ++n) {
sum = fst + snd;
fst = snd;
snd = sum;
}
return fst;
}
int main() {
printf("%d", fib(5));
return 0;
}