 Hello, welcome to the session Fibonacy Sequence Using Recursion. At the end of this session, the student will be able to implement program to find Fibonacy Sequence by using recursion in C. Now, we will see what is the Fibonacy Sequence. The Fibonacy Sequence is a sequence where the next term is the sum of previous two. After the previous two terms are there, the addition will be the next term. The first two term will be Fibonacy Sequence are 0 and 1. Now, here you can see 0, 1, 0 plus 1 is 1, 1 plus 1 is 2, 1 plus 2 is 3, 3 plus 5 is 8, 8 plus 13 is 21, 21 plus 13 plus 21 is 34. Now, to calculate next, we have to add 21 plus 34, so it will be 55. One more way we can find it that is if I want to calculate term 9, then I have to go for the before two terms that is term 9 minus 1 and term 9 minus 2. So, term 8 will be there and term 7 will be there. So, here term 8 is 21 and term 7 is 13, so it will be 34. So, if we are knowing the previous terms, then it is very easy to calculate the Fibonacy Sequence. Now, here we will see the Fibonacy Sequence with the iteration first, we will be having i is equal to 1 up to the n terms and then we will go for the printing the term 1. So, what is the term 1? Term 1 here we are having 0 and T2 is having 1. So, first term will be printed as T1, T1 is 0. So, this first term is 0. Then what we are doing? Next term is equal to T1 plus T2. So, 0 plus 1 it will be next term that is a 1. Now, next what we are doing? T1 is replacing by T2 and T2 is replacing by next term. So, what will happen in this case? Our T1 will be replaced by T2 that is 1 and T2 is replaced by next term that is again 1. So, here that will be again printed into the loop. So, here it will be 1. Then next we will see what will happen? T2 will be replaced here and next term will be replaced here 1 plus 2 that will be next term is 3. So, here it will be printing T1 is 1, T2's value previous T2's value that is 2 and T2 is equal to next term that is 3. So, it will be 5 and that time your T1 is 2. So, it will be printing 2. And this one is fifth round we are having then at that time we are having T1 is equal to 3 this one and T2 is equal to 5. So, next term it will be 8, but T1 is 3. So, 5 terms it will be printed 1. In the recursion what we are doing? We are having this function for the recursion that is if n is equal to equal to 0 will return 0 it is 1 then we will return 1 otherwise we will recursively call the Fibonacci series. Here the previous term that is n minus 1 and plus its previous term is n minus 2. So, what will happen in that case? In the previous term we will see the procedure. If I want to calculate 3 Fibonacci's term 3 then it will call its previous 1 that is 2 and its previous 1 is 1. So, it will call 2 and it will call 1 then 2 will call 1 and its previous 0. When it will having next call that time it will return 1 here it will return 0 and then 1 and this is 0 it will come to this Fibonacci's term and this 1 it will come this Fibonacci's series and then they will be having at this position that is in this way it is going to calculate step by step. It is this is the biggest number if we are having to consider 3 then it will calling the smallest smallest and smallest like this where the answer is there where the solution is there and that is returning by calling itself that is returning by calling itself. So, this is what the Fibonacci's sequence with the recursion. What is the use of this recursion in this though we are having the iteration method in this case we are not needing that term 1, term 2 or next term just we are having a single variable of which we are calculating the Fibonacci's. Now, how it is implementing as we are seen that we in the recursion we need the stack concept in the stack in the memory now in this case we will see the same Fibonacci's of 5 then this is 5 it will call 4 and 3 then again the next call will be 3 and 2 and 3 will call 2 and 1 then next it will call 1 and minus 1 and then this will call 0 and minus 2 like this the step by step they will be calling this and now when it is reaching to this location now it is end so this is the solution of the problem so it will answer with 0 then it will pass to here it will answer with 1 and that 1 will be replace here it will be 1 and that will be pass to the next that will be 2 and then 2 will be pass to here and then it will be 3 so this is your answer for the Fibonacci's 5 with this 5 terms 0, 1, 1, 2, 3 so this is the stack where we are maintaining this answer so first we are pushing all this one by one first one this one then second then next then next and then they are answering and then we are popping 1 by 1, 0 then 1, 1, 2, 3 like this again you can see this the function of 5 it will be calling 4 and that will be calling again here it will be calling 4 and 3 it will be calling 3 and 2 and here it will be calling 2 and 1 and then it will be calling last one so minus 1 and 0 so here finally it is producing as your n is 1 that time it will be returning 0 value because the answer of this will be the answer of this function will be 1 minus 1 it is 0 and minus 2 so first it will be returning 0 value then it will be forwarded to this so it will be returning 1 then it will be forwarded to the next it will be returning 1 just we have seen in the stack how they are returning then it will be written 2 then next it will be returning 3 so the output of this the solution of this they are popping it and they are forwarding to the next so this is our answer with the recursion so find out the value of the Fibonis is 6 here the table is showing that the all values you can find this what is the term here it should be pause the video and find out the answer answer should be 5 plus 3 that is 8 because the previous values are there 5 and 3 this is the reference thank you.