 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can print these two patterns with C programming. You can note my information. If you want to follow or subscribe my YouTube channel, you can use this link that is youtube.com slash sanjaygupta underscore tech school. You can download my Android app that is TechMS which is available on Google Play. Now coming on to the pattern. First I have to demonstrate you how this pattern will be printed. So you can see here some space is available and then digits are printed. So you can analyze this with this table. Here you can see I have used hyphen sign in place of space so that I can count how many spaces are required to print this pattern in each row. So you can see in first row spaces are four and digits are one. Then in second row three spaces are required and two digits. Then in third row two spaces and three digits in fourth row one space and four digits in fifth row zero space and five digits. So here first loop will be for printing spaces in each row and second loop will be for printing digits in each row. Then third loop will be required to control in which row these spaces and digits will be printed. So now you can see this code here first loop is available which will repeat n times n is received through this print f and scan f and n is representing number of rows. So first loop is starting from one it will repeat n times so n number of rows will be displayed. Then first spaces will be displayed in first row through this loop. So suppose n is five and first time i is one so this loop will repeat four times and four spaces will be displayed. Then through this loop this loop will repeat k times and digits will be printed through this loop and here if condition is available. So here i is representing row number so if row number is divisible by two then it will print zero in each zero in a particular row. If i is not divisible by two then one will be printed in a particular row. So you can see the pattern in odd rows one is printed and in even rows zero is printed. So if i is divisible by two then it is even so zero will be printed otherwise one will be one will be printed. Then after completion of k new line will be displayed through slash n so this way first pattern will be displayed. You can see the output you can compare it with this pattern both are saying now we have to print its reverse. That is in first row five one then four zero then three one two zero and one. So for this I just have to modify this pattern sorry this code and I am modifying only first loop. So i equals to n condition is i greater than equals to one and i minus minus so I have just modified first loop. So it is initializing i by n so suppose n is five so i will be also five then this loop will repeat zero times because five minus five is zero. And k loop will repeat five times and it will print five times one because i is not divisible by two so one will be printed five times. Then k new line then i will be decremented so its value will be four then second time five minus four it will print one space and i loop will be repeated four times. This time i is two sorry this time i is four which is divisible by two so four times zeroes will be displayed so this way reverse of the pattern will be displayed on console. Again i am entering number of rules as five now you can again compare the output both are same but this time pattern is printed in reverse order. So friends I hope you have understood how we can print both the patterns with the help of nested loops in C programming. If you want to watch more programming related videos you can follow this link that is youtube.com slash sanjaygupta underscore tech school. Thank you for watching this video.