 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can print these 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 Tech MS based on programming available on Google Play. Now coming on to the topic. First we have to understand this pattern where space is printed first and then letters are printed. So you can understand it with this diagram here four spaces in first row and one letter is available then in second row three spaces and two letters are available then in third row two space three letters then in fourth row one space four letters in fifth row zero space and five letters are available. So we require one loop which will print space and another loop which will print letters and third loop will be controlling in which row we are printing space and letters. So after this analysis now see this code here number of rows are received inside n variable then I have started a loop which is I starting from one and it is repeating n times then inside this loop I have started another loop which is responsible for printing spaces and this loop is repeating n minus i times so suppose n is five number of rows are five that you want to print first time i is one so whenever you want to print first row then four spaces are required so five minus one is four that's why four space will be displayed then control will be transferred to k loop it is repeating i times so i is one it will repeat one time only then new line will be displayed so in first row four space and one letter will be displayed then i plus plus will take place so i will become two next time five minus two three spaces will be displayed and this k loop will repeat two times so in second row we require three spaces in second row we require three spaces and two letters and that are printing so this way first pattern will be displayed through this loop you can see the output I am entering five as number of rows you can compare the output both are same now we have to print this pattern here in first row five letters then four then three then two and then one letter is displayed and before that space is also available so for printing this pattern we just have to change first loop it is initialized with n condition is greater than equals to one and it is decremented by one so i is starting from n condition is greater than equals to one and i is decremented by one so suppose n is five first time so here in j loop five minus i so five minus five no space will be displayed zero space will be displayed then k loop is repeating five times this time because i is five so five letters will be displayed then new line then i minus minus i will become four so this second loop n minus i it will repeat one time only because n is five and i is four so it will provide one space and then k loop will repeat four times so one space and four letters so this way reverse pattern will be displayed on console you can see the output and you can compare it with this both are same so this way we have printed both the patterns with the help of nested loop for printing second pattern I have just changed in first loop that is i loop which is responsible for providing row numbering and spaces and letters loop both are same so I hope you have understood how you can print both the patterns in c programming if you want to watch more programming related videos you can open my youtube channel through the link youtube.com slash sanjay gupta underscore tech school thank you for watching this video