 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can display these two patterns using C programming. Before starting, you can note my information. You can follow or subscribe my YouTube channel through this link that is youtube.com slash sanjaygupta underscore tech school. You can download my Android app that is Techamiz which is available on Google Play. Now coming on to the topic, first I am going to demonstrate you how you can display this pattern that we just have to print it in reverse order. So for that purpose, you can study this analysis. Here I have represented space with hyphen. So in first row, four spaces and one asterisk or star is required. In second row, three spaces and three asterisk. Then in third row, two spaces and five asterisk. In fourth row, one space and seven asterisk. And in last row, zero spaces and nine asterisk are required. So first loop will be required for printing space. And second loop will be required for printing asterisk. And one more loop will be required to print. Sorry to control these two loops so that which number which row we are printing that can be controlled. So condition of space loop will be n minus i and condition of asterisk loop will be dependent on this odd series one three five seven nine. So here you can see the code. Here first loop which is representing rows. It is starting from one and it is repeating n times n is received through scanf from user. Then inside this loop, one more loop is available which will print spaces and you can see the condition that I have shown you n minus i. So here n is number of rows and i is representing current row. So first time current row is one and suppose total number of rows are five. So five minus one is four. So four spaces will be printed. Then in K loop, we have to prepare series of odd numbers. So for that purpose, I have used i into two minus one. So I will be providing row number. I have multiplied it by two and decremented it by one. So first time i is one. So one into two is two. Then minus one is one. So one asterisk will be printed then slash n. Next time I will be incremented by one. So value of i is two. When control will transfer to J loop, it will repeat n minus i times. So n is five and i is two. So it will repeat three times. In second row, we require three spaces and three asterisk. So with this three spaces will be printed. Now we have to check for asterisk. So i is two. Two into two four minus one is three. So three asterisk are printing. So this condition is representing that I am multiplying natural numbers which are available in i as row number with two and I have subtracted it by one. So if we multiply natural numbers by two and subtracted by one then we receive odd numbers that are one three five seven nine and so on. So with this code, first pattern will be displayed on console. You can see the output and you can compare it. Both are same. Now we have to just convert it into reverse order. So for this purpose, I will be changing its first loop that is i. It is starting from n i equals to n. Condition will be i greater than equals to one n i minus minus. So suppose value of n is five. So first time it will not print any space. No space will be printed. And when k loop will be executed, here you can see the condition i into two minus one. So this time i is five. So five into two ten minus one is nine. So in first row nine asterisk will be displayed. Then new line again i will be decremented. So value of i is this time four. Then five minus four is one. So one space will be printed and then four into two minus one. So eight minus one is seven. So next time seven asterisk will be printed. So this way reverse of the triangle will be displayed. So you can see reverse triangle is available here with nine seven five three and one asterisk. And at beginning the required spaces is displayed. So friends, I hope you have understood how you can print these two patterns with the help of C program which is available in front of you with the help of nested loop. If you want to watch more programming related videos you can follow my youtube channel through youtube.com slash sanjay gupta underscore tech school link. Thank you for watching this video.