728x90 AdSpace

Latest Article

Fibonacci Series using Recursive Function in c++ sample code




How to fibonacci Series using Recursive function in c++ sample code
# include <iostream.h>
# include <conio.h>
# include <iomanip.h>
# include <string.h>



int nacci_series(int);

void main()
 {
   int a;
   //int product=1;
   cout << "Enter an integer: " ;
   cin  >> a ;
   cout << "\n The fibonacci Series: "  << nacci_series(a) ;
   getch();
   }

int nacci_series(int n)
 {

   if (n==0)
    {
      return 0;
      }

   if (n==1)
    {
      return 1;
      }

   return (nacci_series(n-1))+(nacci_series(n-2));

   }
no image
  • Title : Fibonacci Series using Recursive Function in c++ sample code
  • Posted by :
  • Date : 07:16
  • Labels :





  • Blogger Comments
  • Facebook Comments

0 comments:

Post a Comment

Top