# Fibonacci sequence recursive function algorithm question.

Asked 1 weeks ago, Updated 1 weeks ago, 2 views

The Fibonacci sequence has a repetition that the sum of the total number and the total number is the next number, like 11 2 3 5 8 13, which is how this is coded as a recursive function

``````int Fib(int n)
{
if (n == 0)
return 0;
else if (n == 1)
return 1;
else
return Fib(n-1) + Fib(n-2);
}

``````

I don't understand if it's like this. It's not that I didn't understand the ambiguity at all, but the level of understanding is very strong.

Should we understand that the reason why `returnFib(n-1) + Fib(n-2);` comes out is simply because the sum of all numbers and all numbers is repeated, so (n-1) and (n-2) are recursive?

And is there a way to understand recursive functions more intuitively?

c fibonacci recursion

2022-09-20 11:02

I just started learning this programming language and already realized that there's nowhere without math. I need more basic math skills here https://kr-casinos.com/casino-bonuses/ that I use to play reviews on this site. Now I realize that I still need to urgently watch a series of lectures on computing, separate hello in the world, afterwards, I haven't been able to make it yet

2022-09-20 11:02

Popular Tags
python x 1174
android x 247
c x 235
java x 192
javascript x 106
mysql x 30
html x 27
node.js x 24
php x 21
list x 19