PROGRAM FOR FABIONCCI SERIES using RECURSION.
#include <iostream>
#include <conio.h>
using namespace std;
int Fabionnci(int A);
int main()
{
int I = 1 ,No;
cout << "Enter Any Number: ";
cin >> No;
while(I <= No)
{
cout << Fabionnci(I) << endl;
I++;
}
getch();
return 0;
}
int Fabionnci(int A)
{
if(A == 0 || A == 1)
return A;
else
return Fabionnci(A -1) + Fabionnci(A -2);
}
0 comments:
Post a Comment