 Hello friends. I am Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I am going to explain how you can implement these patterns with the help of C programming. Before starting, if you want to watch more programming related videos, you can go to the details of this video. So there you will find various links related to programming players to do one step. Now, first I am going to implement the solution for this pattern. Then I will tell you how easily you can convert that pattern to print this one and this pattern. So here you can see we have five different rows. We have five different rows and these number of rows can be any number. So right now it is five. So user can enter that I want to print 10 rows. User can enter like I want to print 15 rows. So number of rows will be entered by the user. So I am assuming that that will be stored inside n variables. So you will use print app and scan up to read that number from the user. So starting from main, I will be using these three variables n, i, n, j. Now inside print app, I am writing enter number. So this message will be displayed on output screen and user will provide a number into n variable. So n is having how many number of rows you want to print. So let's say n is five. So we need to print five rows. So we need to implement one loop that will repeat five times. So for that I am implementing first for loop. So because I need to iterate this loop five times, so that's why I started it from one and condition is I less than equals to five. So it will start from one and it will end to five. So it will be five times. Then it will repeat first time. So it will print one. That is one. Then if it repeats second time, so this needs to print two digits. That is two times. So it means inside this loop, we need to implement one more loop that will be printing these digits. And that loop will depend upon the value of i, like how many times that loop will repeat. So inside this loop, I am going to implement one more loop. So here see the condition j less than equals to i. So j loop termination condition is dependent upon i. It will iterate as per the value of i. And then you can write j plus this, right? Now inside this loop, you need to write print f percent b. Now here you can see in each row, we need to print same visit. In each row, we need to print same visit. So if you go to first round values one, if you go to second row values two, third row values three. So it means we need to print value of i because i is pointing to the row. So here we can print value of i and we can prove this. After completion of this loop for new line, you can use this print f. So it will print new line character that is backslash m so that cursor will be shifted to new line. Then this for loop will be completed and then main function will be completed. Now I am going to explain the execution cycle of this loop so that you can see how it will be printed. So initially value of i will be one, initially value of i will be one. Check this condition. It is true. Now we will move to this loop. So when condition of outer loop that is i is true, then we transfer control to inner loop, then inner loop will complete its cycle, then it will come to this print f and then control will move here. So j is starting from one, condition is j less than equals to i and what is the value of i? It is one. So this loop will repeat one time and what value will print value of i? So here you can see one will be printed one time that it will complete a print f will print new line that i plus plus. So this time value of i is two. This time value of i is two and again we are entering into j loop. So j will begin from one and it will move to i. So right now value of i is two. So how many times this loop will repeat two times because it is again starting from one and it is going to two. So two times it will repeat and two times it will print value of i. So see carefully why we are rotating this loop. So anywhere are we changing the value of i? No, we are not changing value of i anywhere. So inside this loop value of i will be two and that will be printed two times. So now I hope you understood why I took i here. After completion of this loop print f will print new line then i plus plus will take place. So i will become three. Again j will start from one and it will move three times now because i is three. So it will repeat three times and three times i will be printed. So value of i is three. So three times three will be printed. So this way this loop will print the pattern. Now if I replace this i to j, so this pattern will be printed. Now see how. So again initially value of i will be one. It will start from one j loop and move to one. So j will print one so it is five. Then new line then i plus plus so i will become two. I will become two. So again j will begin from one it will move to two. And now here you can see we are printing j not i. So first time j is one so in second row. In second row you can see j is printing one first. Then j plus plus so it will become two because this time loop will repeat two times. So j will become two and next time it will print two. Then it will be terminated new line will be printed i plus plus. This time value of i is three. So it means j will repeat three times starting from one to three. So j first will print one then two and then two. So this time we are printing j because we want every time printing will start from one and it will go to that value which is representing the loop. So this way this change will print the second pattern. Everything will be same except this i will be replaced to j. Now we are going to print this one. So here you can see continuous visits are printed one two three four five six. So we can't use i we can't use j. So we need one more variable k and that I am starting from one. So in place of j I am going to print k here. And after printing I am going to increase it by one. So that next visit will be available. So if you rotate this so when i will be one. So this j loop will repeat one time so k will print one after printing k it will become two. After printing k one it will become two but j is repeating one time so it will terminate. Then we will move to new line then i plus plus will take this so i is two now. Then j will repeat two times. So first time it will print k so what is the value of k it is two. So two will be printed and k plus plus will make it to three. So this time j is repeated only once. So j loop printed value of k then it is incremented to three. So this is one rotation one rotation is more pending. So j will increase its value check the condition it is true. Then again k will print so right now k is three and after printing it will become four. So now two rotations are completed so two and three are printed. Then completion of this loop new line i plus plus. So i will become three. So this time j will repeat three times. So three times k will be printed and three times k will be incremented. So first we will print k the last value of k is four. So it will print four and after that it will increment to five. So printing of k and its increment is completely one rotation of loop. So now we print five and increase it to six so it is second rotation. Then again print k that is six and increase it to seven. So it is third rotation. So after this third rotation this j will terminate new line with print and i plus plus. So i will become four and so on. You can print the rest of the digits. So this way these three patterns can be printed with the same profit. You just need to put i, j and k values here for this first, second and third pattern. So I hope you understood how you can print these three patterns of the DynamoC program. So implement this solution in your laptop so that you can understand how this is working. And if you want to watch more programming related videos you can open my channel go to playlist. There I have uploaded more than 1000 videos so you can watch them. And I hope you understood whatever I explained in this video. Thank you for watching this video.