 Hello friends. I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to explain how you can print factorials of each natural number with the help of C program. So here you can see, we need to print this kind of series in vertical form or you can also print it horizontally that depends upon the requirement. So first we need to print one factorial, then two, then three, then four, then five and then so on. So first we are going to need a value from user that is n, like how many times you want to print those factorials. So if user enters, let's say n is 10. So we need to print a factorial from starting 1 to 10. So 1 to 10 all digits factorial number we need to print on outputs. So I'm going to explain this implementation with the help of C program. Before starting, if you want to watch a more programming-related video, you can go to detail or description of this video, where you will find links of various failures so you can watch them. Now I'm going to write the program so that we can have this kind of output. So I'm starting from main. So one variable I will be required then m and f which will be having calculated factorial. Now I'm going to read value of n. So n will be stored. The value of n will be stored inside n variable so that we can iterate the loop. Now here I'm going to write a loop which will repeat n times and inside this loop I have to calculate factorial and then immediately I need to print that factorial. So printer will come inside for loop because I need to print various outputs. So here I'm writing this and so output will be like this one, then it's factorial, then two, it's factorial, then three, it's factorial. So this way I'm going to print output. So that you can see the natural number is what and its factorial is one. So backslash n equals two percent d, then i and f. So this way, this is the logic, then I'm closing these. So this way this program is completed. Now I'm going to explain how this will work. So let's say n is five, we need to print these five outputs. So here I'm going to print output. So n is five, i is starting from one and f is also one. So that is available in the starting. Now calculate this f into i. So one into one, f will be one. Now we need to print. So percent d, this percent d will be replaced by value of i. This percent d will be replaced by value of f. So an output screen, this will be printed one equals to one. So left inside one is natural number and right inside one is its factorial. Then i will be incremented. So it will become two. Now multiply this. f is one, i is two. So two into one, new value of f will be two. So this time output will be two equals to two because i is also two and f is also two. Then i will be incremented. So its value is three. Now calculate this. f is two, i is three. So new value of f will be six. So again, this will be printed. So factorial of three is six. So that is printed correctly. Then i will be incremented. Sorry, i will be incremented to four. Now calculate this. f is six, i is four. So six into four is 24. That will be stored inside f. So right now i is four and f is 24. So these two values will be printed. Four equals to 24. So four is natural number and its factorial is 24. Then i will be incremented. So it is five. So f is 24, i is five. So the result will be 120. That is available in f. Now print both. So i is five and f is 120. So that is factorial of five. So this way the series will be printed on output screen with the help of this print f. If you want only factorials, so you can print f. If you want both natural numbers along with their factorials, you can use this print f that i demonstrated. So i hope this is very easy to understand how i calculated factorial of each natural number. If you increase the value of n, so it will repeat that particular time and those outputs will be printed on output screen. So i hope you understood whatever i explained in this video and this was very easy. You can implement it in your laptop so that you can understand it well. If you want to print it horizontally, you can remove this backslash and it will print it on a single line. So i hope you understood whatever i explained. If you want to watch more programming related videos, you can open my channel and go to playlist. So do watch them so that you can understand programming well. Thank you for watching this video.