 Hello friends, I am Sanjay Gupta. In this video I am going to demonstrate you how you can print these two patterns using dastard loop in C programming. Before starting you can note my information. You can follow or subscribe my youtube channel that is sanjaygupta underscore tech school. You can download my android app based on programming that is tech image which is available on google play. Now coming on to the topic. For demonstration I have implemented a code which is including a header file stdio.h. Then inside main three variables are declared. Then printf will display enter how many rows you want to print, message on console. Then scanf will read number of rows from user in n variable. Now first I have implemented for loop which is starting from 1 and its condition is i less than equals to n. Inside this for loop another for loop is implemented which is starting from 1 and it is repeating j less than equals to i. So first loop is repeating n times second loop is repeating i times and then inside printf I am printing i. So with this loop if I execute this program first pattern will be displayed which will display 1 then 2 times 2 3 times 3 4 times 4 5 times 5. Now I want to print this pattern 1 then 1 2 1 2 3 1 2 3 4 1 2 3 4 5. So here in place of i I am using j variable in printf. So suppose value of i is 1 and n is 5. So first time this condition will be true. Then control will be transferred to j loop. j is beginning from 1 and i is first time 1. So this loop will execute 1 time. So j will print 1. After termination of j loop new line will be displayed. Then control will be transferred to i plus plus. So this time i is 2. Then condition will be checked. Suppose it is true because n is 5. So control will be transferred on j loop. Now j is starting from 1 and i is 2. So j will repeat 2 times. So first time its value will be 1 and second time its value will be 2 and we are printing j. So it will print 1 and then 2 as a pattern required. So if you replace j in place of i in printf statement then second pattern will be displayed on console. Now I am executing this code. You can see the output. Second pattern is displayed on the console with the help of this program. So friends if you print i on console then first pattern will be displayed. If you use j as a printing variable then second pattern will be displayed on console. I hope you have understood how you can print both the patterns using C programming. If you want to watch more programming related videos you can follow or subscribe my youtube channel that is Sanjay Gupta underscore tax school. Thank you for watching this video.