If Any Required Program Please Ask In Comment I Will Help You(any Program in JAVA or C++) . . THANKS FOR VISITING MY BLOG!

If U LIKE MY PROFILE RAISE YOUR HAND IF U NOT RAISE UR STANDARD. Powered by Blogger.

Sunday, October 21, 2018

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