 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can count number of digits available in a number 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, I am going to demonstrate you the program to count number of digits available in a number using recursion in C. I am including a header file stdio.h then I am declaring a function int count int. This statement is function declaration. After this function declaration, I am defining main function. Inside main function, I am declaring a variable n and another variable c. Then printf display or masses enter a number whose digits we want to count. That number will be received by scanf and that number will be stored inside n. Now I have to call count function using c equals to count of n. Here value of n is passed and the result will be stored inside c. This statement is known as function call. The result which is available inside c will be displayed with the help of printf statement. This message I am going to display using printf. Counted digits are equals to %d and this %d will be replaced by c. At last, return 0 because return type of main is integer. Now I am defining count function. So it is function definition. Inside this function definition, I have to write some statements. This count function will be implemented as recursive function because inside its definition, I will be calling this function. So first I am implementing a base condition. Before that, I am declaring a static variable. This base condition is containing condition n equals to 0. If this condition is true, then value of c will be returned. Otherwise inside else, c will be incremented by 1 and count function is called. It will pass number divided by 10. So this is recursive function call. So this is complete implementation of this program. In this function definition count, I have declared a static variable which is initialized by 0. So static variable initialize only once. If we call a function again and again, then it uses its previous value instead of starting it from the beginning. That's why this variable is static. So if n is 0, then value of c will be returned. Otherwise c will be incremented by 1 and count function will be called by n by 10. So n will be divided by 10 each time so that the number will be reduced. Now first of all, I am executing this code. I am entering a number 1, 2, 3, 4. You can see counted digits are 4. So this code is working properly. It is counting the number of digits which are available in a number properly. This program is implemented with the help of recursion in C. So I hope you have understood the concept well how to implement a code which can count the number of digits which are available in a number using recursion in C. If you want to watch more programming related videos, you can subscribe my YouTube channel. Thank you for watching this video.