0




#include<iostream.h>
int fibonacciRec(int n){
if (n==0)
return 0;
else if (n==1)
return 1;
else
return fibonacciRec(n-1)+fibonacciRec(n-2);
}

int main(){
int n;

cout<<"Digite um inteiro para calculo do fibonacci \n";
cin>>n;
cout<<"O Fibonacci eh:"<<fibonacciRec(n)<<"\n\n";

system("pause");

return 0;

}

OBS: Compilado na IDE DevC++.


Post a Comment

 
Top