 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 three patterns in the help of C-Program. Before starting, one information, if you go to detail or description of this video, you will find links of various pay lists. Those are related to various programs. So you can watch them. Now, first I am going to explain the implementation of this pattern. So here you can see we have five different rules and before printing alphabets, we need to print spaces as well. So here I need to implement three loops. How I identify that? So first loop will be for identifying on which loop you need to print alphabets. So let me write that here. So let's say this is first loop and right now I am going to repeat it five times. Why so big is five rows I have to print? So it will start. Now before printing alphabets, we need to print some spaces. And if you see with the help of this dash, so dash is representing spaces here. So if you see the pattern of spaces, so in first row, four spaces, second row, three, then two, then one and then zero. So these number of spaces we need to print. And after that we need to print the alphabets. So alphabets in first row one, then two, then three, then four and then five. So if we are on fourth row, then we need to print four alphabets. If we are on fifth row, then we need to print five alphabets. So this way alphabet loop will be repeated. So alphabet loop will depend upon the i value of five because i is representing row number. Now we need to identify how these spaces will be printed. So if you identify the logic, so we can write this. So if we write five minus one to four, five minus two, three and so on. So five is total number of rows and one, two, three, four is representing the current row number. So if we put this logic, then we will be able to identify how many spaces we need to print. So I am going to use this logic. So I am implementing second loop, which is J and this J loop will repeat this time. So J starting from one, its condition is J less than equals to five minus i and then J plus plus. And inside this loop, I have to print space. So this way space will be printed. So first I am going to complete this program now, then I will be explaining each line so that you can understand how this will be printed. So V will be, so this is second loop, which is starting from one and it will also repeat. So here condition is K less than equals to i and then K plus plus. Then opening the current basis and now you can see we need to print the alphabets. So alphabets are starting from A. So before starting the loop, I need a character variable. So here you can see I have declared a character variable and this character variable is initialized with capital A. So it is the winning value of this variable and here inside this K loop, I am going to print that character variable. So here you can see printed then percent C and then CH. So CH variable will be printed with the help of CH because we are going to print the character. So if you want to print the characters then we require percent C. So this loop will print the alphabets. After this loop, completion of this loop, I am going to increase value of CH. So CH plus plus for that and then I am writing print F and backslash it and closing this I fall. So this way I implemented the complete solution. Now I am going to explain it line by line so that you can understand how it will be printed. So initially value of I will be 1. Starting from here, condition is true. Now come here to this loop. So now this loop will complete its rotation cycle. So it is starting from 1. Here see the condition 5 minus I. So 5 minus 1 because value of I is 1. So 5 minus 1 is 4. So this loop will repeat 4 times and it will print these 4 spaces. So dash will not be printed. Space will be printed because inside this double code here you need to put a space using a space bar. Then after completion of this loop, this loop will repeat. It will repeat one time because here condition is K less than equals to I. So value of I is 1. That's why this loop will repeat one time and it will print the value of CH. So CH is right now 8. So it will print 8. After completion of this loop, so initially CH was 8. After completion of this loop, CH will be incremented to B and then print F will be printing back to Lashen. So that control will be transferred to new line that I less less. So I will become 2. Again control will be transferred to this loop. So 5 minus 2. This time it will be 3. So this loop will repeat 3 times. So 3 spaces will be printed. That this loop will be completed. Control will be transferred to this loop. Now value of I is 2. So this loop will begin from 1 and will go to 2. So it will repeat 2 times. It means CH will be printed 2 times. So see the value of CH. It is B. So B will be printed 2 times. And why 2 times B? Because inside this loop, we are not changing the value of CH. So that's why it will print same value. So if K loop will repeat 2 times, so 2 times same value, which is available in CH will be printed. Now after completion of this loop, CH will be incremented. So it will become C. Control will be transferred to new line then I plus plus. So I will become 3. Now as per value of I, this loop will repeat 2 times and this loop will repeat 3 times. So it will print 3 times value of CH pattern B. So this way this pattern will print the pattern. So here you saw 3 loops are available. First is controlling loop. Second is printing spaces and third is printing alphabet. Now we can easily convert this into this because space logic will be same. Row logic will be same. We just need to manage the printing of alphabet. So here you can see at the beginning, every time we need to print A and then we need to increase the value of alphabet whenever we are printing that. So before starting this, I am initializing it with A and I am shifting the CS plus plus inside this loop. So I am going to iterate it. Let's say 2 times so that you can understand how it will work. So quickly I equals to 1. Condition is 2. So CS will be initialized with A. This loop will repeat 4 times. So 4 spaces will be printed. So let's say 4 spaces are printed. Then this loop will repeat 1 time because initially value of I is 1 and it is A. So it will print A. This is printed. Then CS plus plus so it will become B. Then this loop will be terminated. We will move to new line. Then I plus plus, I will be 2. Then here you see again CS will be initialized with A. Then this loop will repeat 3 times. So 3 spaces will be printed. Then we come here. It will repeat 2 times because value of I is 2. Then first time CS will be printed. So here you can see value of CS is A. So this A will print then CS will become B. So printing of CS and increment of CS is one rotation that is done. Now again CS will print. So you can see value of CS is B now. So that is printed and it will increment to C. So 2 rotations are completed. Then move to new line. I plus plus and again you can see CS is initialized with A. So every time we need to print A from the beginning of the loop and then we need to increase the outputs. So that's why initialization is done here and increment is done inside this A loop. Okay. So I hope you understood 2 minor changes and this pattern is implemented. Now simply we can implement this one. So one change. We move this from here. Don't initialize because every time we are increasing only and before starting I we need to initialize CS with A. And then whenever the value of CS will be printed just after it will be implemented by 1. And rest of the logic will be same. So see how easy this is. So this way I hope you understood how we can print these patterns with the help of nested loops. If you want to watch more programming related videos you can open my channel and go to playlist there you will find various programming related videos. So do watch them. And I hope you understood whatever I explained in this video. So thank you for watching this video.