Quiz week 8

In this quiz, we have to calculate wich is the number of the fibonacci series.

Captura.PNG

If you want to make improvements or modifications, here is the code for you to copy and paste it anywhere.

#include <iostream>
using namespace std;

int fibonacci(int n){
int answer, n;
if (n==0 || n==1){
answer=0;
} else {
answer = fibonacci(n-1) + fibonacci(n-2);
}
return answer;
}

int main(){
fibonacci(n)
cin >>n>> endl;
x = fibonacci(n);
cout <<x<< endl;
return 0;
}

Leave a comment