 Hello friends, I am Sanjay Gupta. In this video I am going to demonstrate you how you can print these two patterns using C programming. Before starting you can note my information. You can follow or subscribe my youtube channel by following this link that is youtube.com slash sanjaygupta underscore tech school. You can download my android app based on programming which is available on google play. Now coming onto the topic. First you have to understand how this pattern will be displayed. So you can understand it by this pattern. Here you can see I have replaced space with hyphen. So in first row four spaces and one digits are required. Then in second row three spaces and two digits are required. Then two spaces and three digits. Then in fourth row one space and four digits and in fifth row zero space and five digits. So this way I have identified how many times space loop will repeat and how many times digit loop will repeat. So if we are talking about first row, if you want to print first row then one loop will be required for space that will repeat four times and second loop will repeat one time to print digits. Then to print second row space loop will be repeating three times and digits loop will be repeating two times and so on. So now I have to implement a code in C to display this pattern. So two loops we have identified one for space and one for digits and one more loop will be required to print how many rows you want to display. So you can see here I have implemented first loop that is starting from one and it will repeat n times and value of n is received through printf and scanf. So this loop will repeat n times and it will control rows. When value of i will be one control will be transferred to this loop which is j and it will print spaces. So j is starting from one. Suppose n is five we want to print five rows. So this condition is five minus i is one first time. So five minus one is four. So this loop will repeat four times. So four spaces will be displayed. After termination of this j loop control will be transferred to k loop. So j and k both are independent loops. When j will be terminated then control will be transferred to k loop. k will print digits and it is repeating i times. So first time i is one. It will repeat one times and i will be printed as value. So i is representing row number. So first time it is one. So one will be displayed. Then after completion of k new line will be displayed through slash n. Then control will be transferred to i plus plus. This time i is two. So second loop j will repeat n minus i. So n is five i is two. Five minus two is three. So this time space loop will repeat three times and this k loop will repeat two times because i is two and i is two. That's why two will be printed twice. This way all the digits will be displayed on console. So I am executing this code. I am entering five as number of rows and you can see the output. It is equivalent to this pattern which is required. Now we have to print its reverse order. So for that purpose I am changing only i loop. It is starting from n. Its condition is i greater than equals to one and i minus minus. So this way I have changed the rotation cycle of i loop. It is starting from one and it is decremented to one. Best of the loops are same. So now again I am executing this code. I am entering five. You can see the output and you can match it with the requirement. So here by changing in first loop the reverse of the pattern is displayed properly. So this way I have implemented both the pattern in c programming with the help of nested loops. Here total three loops are required to print these two patterns. I hope you have understood the concept well. If you want to watch more programming related videos you can open my youtube channel through youtube.com slash sanjay gupta underscore tax school URL. Thank you for watching this video.