 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can print these two triangles on console using 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 that is Techimace which is based on programming and it is available on Google Play. Now coming on to the topic, first I am going to demonstrate how you can print first triangle with the help of this C program. So here using printf scanf, I am going to receive how many rows user want to print on console. Then you can see first loop is repeating from 1 to n. Suppose n is 5, so this loop will repeat 5 times. When value of 5 will be 1, then condition will be checked. If it is true, control will be transferred inside jloop. So jloop will repeat from 1 to i. So this time i is 1. So this loop will execute one time and 1 will be displayed on console. After termination of jloop, control will be transferred to printf and this printf will print newline on console using slash n. Then i++ will be executed. i becomes 2. Condition 2 less than equals to 5 which is true. Again control will be transferred on jloop. This time j will repeat 2 times. So first j will print 1 and second time j will print 2. So this way first pattern will be displayed with the help of this code. I am executing this code so that you can see the output. You can see first pattern is displayed on console with the help of this program. Now we have to print the first pattern in reverse order. So for that purpose you can change first loop only. i equals to n, then i greater than equals to 1 and then i minus minus. So by changing this first loop, i is starting from n. So n is 5. 5 greater than equals to 1. Condition is true. Now jloop will repeat 5 times from 1 to i. i is 5. So this loop will repeat 5 times. So it will print j 5 times. So first time j is 1 then it will become 2, 3, 4 and 5. So j will print 1, 2, 3, 4, 5 in a single row. After termination of jloop, newline will be displayed on console. Then i will be decreased by 1. This time i is 4. 4 is greater than equals to 1. Condition is true. Then again jloop will be executed. This time it will execute 4 times starting from 1 to 4. So it will display 1, 2, 3, 4 on console and this way the reverse of the triangle will be displayed on console. Now i am executing this code. You can see the output. Reverse triangle is displayed which is printing 1, 2, 3, 4, 5 in first row, 1, 2, 3, 4 in second row and so on. So friends this way with the help of this program you can print reverse of the first pattern. So i hope you have understood how you can print both the patterns on console. If you want to watch more programming related videos you can follow or subscribe my youtube channel that is sanjaygupta underscore tech school. Thank you for watching this video.