Untitled
user_7016102
plain_text
2 years ago
355 B
7
Indexable
//LAB 7
#include<iostream>
using namespace std;
int fabi(int n)
{
if(n==0)
{
return 0;
}
else if(n==1){
return 1;
}
else{
return fabi(n-1)+fabi(n-2);
}
}
int main()
{
int n,i;
cout<<"Enter the number : ";
cin>>n;
cout<<"The fibonacci of "<<n<<": "<<endl;
for(i=0;i<n;i++){
cout<<fabi(i)<<"\t";
}
return 0;
}Editor is loading...
Leave a Comment