 Hello friends, I am Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to explain how you can count number of digits that are available in an input number. Right. So before starting, I just want to share information. So if you go into the detail or description of this video, you will find links of various playlists so you can learn various programs related to those. So do watch them. Now coming onto the topic. So first, let me take some examples so that you can understand what we are going to do. So let's say a number is 1234. So it is a one number. So it is 1234. Now we need to count how many digits are available in the number. So output will be 4. Let's say user has entered 2468. So again, output will be 4. If number is 204, then output will be 3. If number is 12, then output will be 2. If number is 1, then output should be 1. So as per the input, we need to count how many digits are available in a particular number. Now after explaining this requirement, now I'm going to implement its solution in C programming. So first time a defining main function, inside main function, I am declaring a variable C whose initial value will be 0. Then one variable N that will read the number from user. Now through printf, I can print a message, enter a number. So user will input a number. So that will be received into N variable. So using this printf scanner, I am able to read a number from user. Now I am applying my loop. Here I am implementing if condition is like N is greater than 0, then only this loop will repeat, otherwise it will be terminated. Inside this loop, I am going to increase value of C. So here you can see initial value of C is 0. So here it will be incremented by 1 every time whenever this loop will repeat. And then I am applying N equals to N by 10. Right? So now I am taking an example. Let's say input number is 2468. So value of N will be this. And initially C is 0. Now I am going to rotate this loop so that we will identify after termination of this loop what will be the value of C. So that is the count which will show how many digits are available in the number. So N is this. And if we see this condition, so it is N greater than 0. So right now N is greater than 0. So it is true. Then we will go inside the Y loop. So C plus plus. So here C will become 1. Then N is divided by N and the result will be stored inside N again. So output of this expression will be 246. So whenever you divide a number by 10, so the last digit of the number will be removed and remaining number will be stored in this N variable. Now again we will move to this condition. So N is again greater than 0. It is 246. So it is true. Again C will be incremented by 1. So right now value of C is 2. Then again divide N by 10. So it will become 24. Again check this condition. So it is true. Increase value of C by 1. So it will be 3. Again divide N by 10. So it will be 2. Check this condition. It is again true. Then C will be incremented by 1. So it is now 4. Again divide the number by 10. So if we divide 2 by 10, so now it will become 0. Now this time if you check the condition, so it is false. And if you see the value of C, it is 4. So we took 4 digit number for example. So output you can see it is showing 4 here. So after completion of this loop, you can easily print count equals to person D and you can print value of C as output. So after termination of this loop, this printer will be displaying the value of C. So it is having the number of digits those are available in the number. So this way I explain to you how we can count number of digits those are available in input number. So I hope you understood. So if you want to watch more programming related videos, so you can open my channel and go to playlist so there are various programming related videos are available. I have uploaded more than 1000 videos related to various programming. So do watch them and I hope you understood whatever I explained in this video. Thank you for watching this video.