Code:
#include<bits/stdc++.h>
using namespace std;
//int ar[]={1,2,3,4,5},sum;
//int x;
int n;
int f(int i)
{
//int i=1;
//cout<<i<<" "<<x<<endl;
//x+=i;
if(i<2)
return i;
return f(i-1)+f(i-2);
}
int main()
{
while(cin>>n)
{
for(int i=0;i<=n;i++)
cout<<f(i)<<" "<<endl;
}
}
#include<bits/stdc++.h>
using namespace std;
//int ar[]={1,2,3,4,5},sum;
//int x;
int n;
int f(int i)
{
//int i=1;
//cout<<i<<" "<<x<<endl;
//x+=i;
if(i<2)
return i;
return f(i-1)+f(i-2);
}
int main()
{
while(cin>>n)
{
for(int i=0;i<=n;i++)
cout<<f(i)<<" "<<endl;
}
}