 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can print these two patterns with the help of C programming. Before starting, you can follow or subscribe my YouTube channel, that is youtube.com slash sanjaygupta underscore tech school. You can download my Android app, that is Techimage, which is available on Google Play. Now coming on to the topic. In first pattern, you have to analyze first the number of spaces and digits. So for that purpose, you can see this scenario. Here I have used hyphen in place of space so that I can count how many spaces are required in a particular row. So in first row, four spaces and one digits will be printed. In second row, three space and two digits. In third row, two space and three digits. In fourth row, one space and four digits. In fifth row, zero space and five digits are required. So for printing this, one loop will be required for printing space and one loop will be required for printing digits. And third loop will be required to control these space and digits loop. Then after printing this pattern, we have to print this pattern in reverse order. So first understand how you can print first pattern. So here first loop, which is repeating n times. Here n is received through printf scanner from user. So n, sorry, first loop is responsible for rows and it will provide value of i as row number. Then that i is used in second loop as n minus i. So this loop will repeat n minus i times to print spaces. So if n is five, first time i is one. So five minus one is four. It will provide four spaces. When value of i will be two, it will repeat three times. If i is three, then it will repeat two times and so on. Then after printing spaces through J loop in a particular row, k will be repeated. So k is repeating i times. And here we are checking value of k by dividing it to if remainder is zero. If value of k is even, then it will print zero. Otherwise it will print odd. As you can see in this pattern at odd positions, one is printed and at even positions, zero is printed. So for that purpose, I have used this condition. Then for line change, I have used printf slash n. So with this code, first pattern will be displayed on console. You can compare this output. This pattern is equals to first pattern. Now I have to print it in reverse order. So for this purpose, I am just changing first loop. So it is initialized with i equals to n. Its condition is i greater than equals to one. And it is decremented by one each time. So by changing this, it will print the pattern in reverse order. You can compare this output with this. Both are same. So this way, reverse of the pattern is printed. I hope you have understood how we can print both the patterns with nested loops in C programming. If you want to watch more programming related videos, you can follow my YouTube channel through this link that is youtube.com slash sanjay gupta underscore tech school. Thank you for watching this video.