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
array of class objects and single inheritance

Two kinds of line detection are implemented in OpenCV, the Hough Transform and the probabilistic Hough transform. Assume that there are n feature points in an image and that it tak



What are header files? What are their uses? - Header files are also known as library files. - They carry two significant things: definitions and prototypes of functions bein

Aim: To implement a program to find area of rectangle, surface area of box and volume of box using virtual functions. Code:                       class rect {

Write a c++ program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points c

Write a function that has int parameter n, makes another type of mask having n bit 1's from the left most bit and 32- n bit 0's next. The mask is called netmask in this seminar, an

Hi, I want to get rtsp source for windows

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send