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
program for compiler design in c

decodes the sending smuggler string from the number format into plain text

how to write code for z transformer

Program is to store all ASCII char into a file: void main()     {   ofstream  fout("ascii.txt");   int i,n=256;   for(i=1;i     {     fout     }

Create a Document that show information about albums. First create a paragraph or two about the purpose of the page and your interests in music: genres, styles, etc. Next have a

We have used logic symbols in the past, but not really though about the actual real devices. Semiconductor companies have taken the logic symbols are manufactured them into logic f

Ask quIn the Byteland country a string "s" is said to super ascii string if and only if count of each charecter in the string is equal to its ascci value in the byteland country as

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

Write a C function to solve the system of linear equations A x = y where A is an N by N matrix in the format of pointer-to-pointers and y is a vector in the format of a pointer. Th

Write a Program for Calculating Value of an Integer? For a clear understanding of recursive function we shall see an illustration for calculating value of an integer. main() {