|
#include<iostream>
using namespace std;
int
fibonacci_series(int i)
{
if(i==1)
{
return
0;
}
else if(i<3)
{
return
1;
}
else
{
return
(fibonacci_series(i-1)+fibonacci_series(i-2));//call
recursive function
}
}
void
main()
{
int
limit;
cout<<" Insert the limit
of fibonacci series:";
cin>>limit;
for(int a=1;a<=limit;a++)
{
cout<<fibonacci_series(a)<<",";
}
}
0 comments:
Post a Comment