#include<iostream>
using namespace std;
int anik(int a)
{
if(a == 0 || a == 1)
{
return 0;
}
else if(a == 2 || a == 3)
{
return 1;
}
else
{
return anik(a-1) + anik(a-2) + anik(a-3);
}
}
int main()
{
int n, i, j = 0;
cout << "Enter A Number :: ";
cin >> n;
cout << endl;
cout << "Tribonacci Series :: ";
for(i=1;i<=n;i++)
{
cout << anik(j) << " ";
j++;
}
cout << endl;
return 0;
}
Comments
Post a Comment