 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 these three patterns with the help of C program. So I will be implementing these with the help of NASCAR. Before starting, I want to share one information. If you go to details or description of this video, you will find links of various those are related to various topics in programming. So you can watch them to learn programming. Now I'm going to start writing code to print this pattern first. So this is the first loop that I have written here. It's initializing through one and its termination condition is I less than equals to 5. So it will repeat 5 times because here you can see we have 5 rows. If you want to print more rows than instead of writing 5 here, you can read a variable from user about the beginning of the following. And then you can use that variable here so that required number of lines will be printed to print these type of patterns. So this for loop which is repeating 5 times will point rows. So here we have 5 rows. So 5 times it will repeat. Now if it repeats first time so one alphabet should print. If it repeats second time then 2 alphabets should print. So to print those alphabets I am writing one more loop which is starting from 1 and it will repeat till 5. So this is the basic format of 2 loops. Those will be required to print these kind of patterns. So this is left line pattern. So here you can see we don't require to print blank spaces here. So here you can see when this loop will start from 1. So the second loop is dependent upon i. So if value of i is 1 so it will repeat one type. If value of i will be 2 so this loop will repeat 2 times and so on. So this pattern will be printed. Now we need to identify how we can end these alphabets. So for that I am going to declare a variable ch. So here you can see its data type is cal because we are going to print alphabets that are in form of character. So character variable is required here. And at the beginning I am initializing it with capital A. So to initialize characters we need single codes and inside single codes I have written capital A. Now inside this loop using percent c I am going to print the value of ch. And after completion of this loop I am going to increase value of ch by 1 and then print f backslash. So this is the complete solution for this pattern. Now I am going to explain it line by line so that you can understand how this is going to be printed. So initially I will start from here. So i is 1 and at the top you saw we initialized ch with A. So initial value of ch is A. Now check the condition of i it is true then control will be transferred here. So j will begin from 1 i is 1 so this loop will repeat one time so ch will be printed in form of character so a will be printed. So this a is printed through this. Now this loop is terminated we come here ch++. So whenever we increase any character variable so it is incremented by 1. So the increment operation will be done in the ASCII value of that character. So we have capital A so its ASCII value is 65 so that will become 66 and its corresponding character is capital A. So in short we can say whenever we increase any character so the character increases its ASCII value. So here character was A so it will become B automatically. Then print f will print new line so ch will come to second line so that we can print B 2 times. Now i will become 2 so this time this loop will repeat 2 times starting from 1 and i is 2 so it will repeat 2 times. In 2 times this ch will print same value and current value of ch is B so this B will be printed 2 times. So this is printed now after termination of this loop again ch will be incremented so this time it is C new line so control will be transferred to here. Now i++ will take place so i will be 3 now again if we move to here so it is starting from 1 and it will go to B. So 3 times it will repeat and ch will print C 3 times so these 3 C will be printed. So this way this pattern will print above format and we are using ch++ here so that we can have a different alphabet in different loop. Now i am going to convert this code for this pattern so if we identify the difference. Here you can see in each row we have similar alphabets but here in each row we have different alphabets but each row is starting from A and then it is incremented up to like if row number is 3 so A will become B and then C so 3 alphabets will be printed. If we are on row number 5 so 5 alphabets will be printed. So it is sure that before printing the alphabets ch variables value should be A. So i have decreed this variable A now i am going to initialize it here as well and here i am just declaring it. So before starting j before starting j loop ch will be always A and when this loop will be repeating so you can say we don't need to print same character on an alphabet in one row. So this ch will be shifted inside this loop so i can remove this and i am writing ch++ here inside this j loop and after completion of this this printer will be printed new line and now this program is complete. So this piece of code will print the second part. Now i am going to demonstrate you how it will be done. So i is one condition is true then ch will be initialized with A. Now we will come here so it will repeat one time so it will print A to ch and after printing ch will become B. So this is first condition of j which printed value of ch and incremented its value by 1. After termination print will print new line so control will be transferred to second line. Now i++ will take place so i will become 2. Now here you can see ch is again initialized with A. So ch is having A as initialized then this time this loop will repeat 2 times. So first ch will print A then ch++ will be now having value B so current value of ch will be. Now again this loop will repeat so ch will print B and ch++ so value of ch will become C. So if we are repeating it 2 times so 2 alphabets are printed and last value of ch is B. Now this loop is terminated we are on new line so control will be on new line then i++. Now here you can see ch is again initialized with A. So now i hope you understood why i return ch equals to A here because after completion of j loop ch will be other than A. But on new line we need to start ch from A so that's why before starting j loop it is initialized with A. So this time this loop will repeat 3 times so 3 different alphabets will be printed and after completion of this loop value of ch will be D. Then again we will increase value of i so ch will be initialized by A again. So this way the second pattern will be printed. Now see this one so this is the third pattern here you can see we are going to print alphabets in increasing order. So no alphabets will repeat all will be printed so A, B, C, D, F, E, H, I and so on. So it means we don't require this now here. We don't require this step here we just need to initialize ch at the beginning. Then you can remove this from here and here inside loop you need to print ch and it will be continuously incremented. So this is the solution for this pattern. So i hope now you can iterate this one so that you can understand how this pattern will be printed. So i hope you understood how these 3 patterns will be printed with the help of master loop. I hope you understood whatever i explained in this video. If you want to watch more programming related videos you can open my channel. Go to playlist and there you will find various playlist related to various programming languages. So do watch them and thank you for watching this video.