Can anyone help me i dont understand this at all!

I'm sure if you typed it into Google you would find an answer.

Try to avoid recursive functions if you can, they can slow your program greatly.

Try to avoid recursive functions if you can, they can slow your program greatly.

It all depends on the problem being solved by the recursive function.

agree with bevoX..use iterative method instead of recursive method..

If you have an assignment to do it with a recursive function, you can't exactly do it another way and expect to get credit, can you?

The fibonacci sequence is where each successive number is the sum of the two numbers before it. A recursive function can call itself for previous states! Pass in a parameter to determine which number of the sequence to calculate. Also, remember to put "stop cases" in your function to avoid infinite recursion.

fibonacci is defined recursively as follows
f(n)=f(n-1)+f(n-2)
f(1)=1
f(0)=1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.