The Method Of Getting Fibonacci Using Recursion In C

Asked By 10 points N/A Posted on -
qa-featured

What is the Fibonacci series? How do I get the Fibonacci using recursion in C? does it involve high multilevel coding, or a simple for loop will do the work?

SHARE
Answered By 0 points N/A #331751

The Method Of Getting Fibonacci Using Recursion In C

qa-featured

So answering your first query about what the Fibonacci is.  It is a series of numbers that are layered by the addition of the previous two numbers. Suppose we are starting the series with 0 and 1. So the initial values will be 0 and 1. Then the proceeding terms are made by adding their preceding two-term. However, the process or say the coding for such a program is easy as compared to others. Also, the function can be recursive.

This way is better of getting Fibonacci using recursion in C. Here, the Fibonacci is called recursively until we get the desired output. In the recursive function, we check for the initial number to be 0 or 1. If that is zero or one, we return the value. If that is not the case, i.e, else case, you should recursively call the series with the n-1 and n-2 values.

Login/Register to Answer

Related Questions