Fibonacci function by using simple recursive approach, C/C++ Programming

Implement, in rPeANUt, the a Fibonacci function by using the simple recursive approach. The Fibonacci function can be implemented in c as follow:

int fib(int x) {

  if (x<2) {

    return x;

  } else {

    return fib(x-1) + fib(x-2);

  }

}

Test your implementation (e.g. fib(5) == 5, fib(7) == 13, fib(8) == 21)? What is the biggest Fibonacci number you can calculate in under about 1min of execution time?

 

 

Posted Date: 3/8/2013 6:24:10 AM | Location : United States







Related Discussions:- Fibonacci function by using simple recursive approach, Assignment Help, Ask Question on Fibonacci function by using simple recursive approach, Get Answer, Expert's Help, Fibonacci function by using simple recursive approach Discussions

Write discussion on Fibonacci function by using simple recursive approach
Your posts are moderated
Related Questions
WHAT IS CGI?

WAP TO PRINT ANY NAME ON SCREEN 10 TIMES void main () { int a=1; clrscr(); do { printf ("expertsmind\n"); a++; } while (a getch (); }

I need to include files so you can understand easier.

Problem Write a program in C++ to read N numbers in an array, the user should be able to search a particular number in the array using sequential search algorithm. Writing a

What is the use of default constructor? - It's a constructor that doesn't accept any parameters. - If there is no user-defined constructor for a class, compiler declares a d


construct a console programme for a bank ATM machine.

It''s that spooky time of year when the dead walk the Earth, things go bump in the night, and the Centers for Disease Control (CDC) recognizes the need for zombie preparedness (

Multilevel Inheritance In multilevel inheritance there is a parent class , from whom we derive another class . now from this derived class we can derive another class and so on

manupulates operator precidence