 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can check whether the number is Armstrong or not using recursion in C. Before starting, you can subscribe my YouTube channel by clicking on the link which is available at 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 coming onto the topic, you can see a code which is available in front of you. First statement is a comment which is showing check whether the number is Armstrong or not. Then I have included two header files stdr.h and mac.h. Then a function is declared which is name is Armstrong. It is receiving two integers as input and it will return an integer as output. So this complete statement is known as function declaration. Then main function is defined. In main function, four variables are declared num result length and temp. Then using printf scanf, I am going to read the number which I want to check for Armstrong. Then that num variable's value which is received by the user is assigned into temp. Then with the help of this file loop, I have to calculate how many digits are available in the number. So length is incremented every time by one and temp is divided by 10. So if this condition is true, then this loop will repeat. If condition is false, then loop will be terminated. After completion of this loop, function calling statement is available here. So I have called Armstrong function. It is passing two arguments. First is num and second one is length and the result will be assigned into this result variable. After receiving the result, if condition is checking whether the num and result both are same or not. If they are same, then number is Armstrong will be displayed. Otherwise number is not Armstrong will be displayed on console. This is all about main function. Now coming on to the Armstrong function definition. This function definition is a recursive function. In this function definition, I have called this function. So whenever we call a function inside its definition, that function is known as recursive function. So you can see here a base condition is implemented, which is num equals to zero. If it is true, then return will return zero value. Otherwise return statement will perform this operation. First it will calculate power based on num modulus 10 comma length and then it will call Armstrong function again. So this statement is containing recursive function call. So POW function will be calculating a num modulus 10. It will be considered as base and length will be considered as power. So POW will calculate base and power and that result will be stored inside stack. And then next time Armstrong function will be called based on num by 10 comma length. So when this Armstrong function will be called control will be again transferred to its definition. Then again base condition will be checked. If it is true, then recursion process will be terminated. Otherwise it will repeat. Now I am going to execute this code. First time entering 153. It is showing number is Armstrong. So if we calculate 1 cube plus 5 cube plus 3 cube, then result will be 153. I am again executing this code. This time I am entering 1234. So this time it is a four digit number. So it will be checking it by 1 raised 4 plus 2 raised 4 plus 3 raised 4 plus 4 raised 4. So in case of Armstrong, the number of digits of a number becomes a power while calculating Armstrong value. So this number is not Armstrong. So friends, I hope you have understood how I have calculated Armstrong value to check whether the number is Armstrong or not using recursion. You can implement this code at your own. There is another concept for Armstrong checking, which is based on cube. You can see this code also. In this code you can see I have called Armstrong function here. And then I have checked it with if or else condition. In this Armstrong definition, you can see inside POW, I have mentioned constant power that is 3. So if I am passing a constant power 3, then if number is 2 digit, 3 digit, 4 digit, 5 digit or any number of digits power of each digit will be 3. So you can also follow this code for Armstrong checking. But proper logic for Armstrong checking is this that you have to calculate number of digits and that number of digit becomes power for each digit that is available in the number. So you can choose any particular logic, but this code which is calculating number of digits is perfect. If you want to watch more programming related videos, you can subscribe my YouTube channel. Thank you for watching this video.