 Hello friends, I am Sanjay Gupta. In this video I am going to demonstrate you how you can calculate some of the squares of natural numbers using recursion in C. Before starting, you can subscribe my YouTube channel by clicking on the link which is available at the bottom right corner of this video. You can download my app Techimage that is available on Google Play. You can connect with me by following these details which are available in front of you. Now I am implementing a code for you. First of all, I am including header file stdr.h. It is for printf and scanf. Now I am declaring a function whose name is sum. This statement is known as function declaration. This function will receive an integer as input and it will return an integer as output. Then main function definition. Inside main function, I am declaring a variable n and another variable s. Then printf. Inside printf, I have typed enter value of n masses. This message will be displayed on console. The number which is entered by the user will be received by this scanf function and that number will be stored inside n variable. Now I am calling some function using this statement s equals to sum of n. This statement is function call. This function will receive as input the value of n and the result will be returned back into s variable. Now with the help of this printf, I am going to display the result on console. This is complete definition of main function. After this, I am going to implement definition of some function. This block will be known as function definition. Inside this function definition, I have to implement a code which will work as recursive calling for this function. So recursive means whenever we call a particular function in its definition, then this process is known as recursive. So function name is sum. I am writing its definition. Inside its definition, I will be calling this function again. Here I have to implement a base condition which will be responsible for its termination. So that condition is n equals to 1. If n is equals to 1, then I am returning 1 else return n into n plus sum n minus 1. Here this if condition is known as base condition. Base condition is responsible for termination of recursion and if this base condition is true, then return 1. Otherwise, this return statement will be executed. In this return statement, you can see that here function is called sum and its argument is n minus 1. So this statement is containing recursive function called to sum. So this n into n will be multiplied every time and it will be added by this function call result. Now first I am going to execute this code so that you can see the output. I am entering 3 as value of n and it is displaying 14. So friends, the sum of 1 square, 2 square and 3 square is equals to 14. You can calculate it. Now this return statement which is containing n into n plus sum of n minus 1. How it is working? I am demonstrating to you. Initially this n will receive 3 as I have executed the code. Then it will check base condition which is false. So this return statement will execute. It is having n into n. So right now n is 3. So 3 into 3. This 3 into 3 will be stored inside stack and this sum n minus 1 will be calling this sum function again. So it is passing 2 here. So this time n is 2. Again base condition is false. So last return statement will be executed. It is having n into n. So this time 2 into 2 will be stored inside stack. Then this function will be called again sum. Here 1 will be passed inside the function. So next time n will be 1. Now base condition is true. So this will return 1 only. So 1 into 1 is 1. That's why only 1 will be stored inside stack. Now these values will be calculated. So 3 into 3, 9, 2 into 2, 4, 9 plus 4, 13 plus 1, 14. So 14 already you have seen the output. If we enter value of n as 3 then sum of squares of natural number will be 14. So friends this way you can calculate sum of squares of natural numbers using recursion in C. I hope you have understood the concept well. If you want to watch more programming related videos you can subscribe my youtube channel. Thank you for watching this video.