 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can print this pattern in 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 Techamuse which is available on Google Play. Now to print this pattern, you have to notice that first we have to print spaces and then digits. So I am going to analyze this pattern first. You can see I am printing hyphen in place of spaces so that I can count how many spaces are required in each row. So now I am going to count number of spaces and digits. So in first pattern number of spaces are sorry in first row number of spaces are 4 and digits are 1. In second row spaces are 3 and digits are 2. Then in third row spaces are 2 and digits are 3. In fourth row spaces 1, digits are 4. Then fifth row 0 space and 5 digits. So now we can identify 1 loop will print spaces and 1 loop will print digits and for each row I have identified how many times that space loop and digits loop will repeat. So now I am going to implement solution for this program or for this pattern. So first time implementing i loop which will repeat n times because it will provide row number with the help of i. So this loop is responsible for rows. Now second loop will be responsible for printing spaces and I am repeating it n minus i times. It will print spaces on console. Sorry it is initialized with 1. So suppose n is 5, number of rows are 5. So first time i will be 1. Then control will be transferred to j loop. Here you can see condition is n minus i. So suppose n is 5 and i is 1. So 5 minus 1 is 4. So it will print 4 spaces. Then second time when i will be 2. So this condition will be 5 minus 2. That is 3. So it will print 3 spaces. So this way this loop will print spaces for particular rows as per the value of i. Now for printing digits I am starting another loop that is starting from 1 and it will repeat i times because in digits in first row 1 digit is required. In second row 2 digits. So when i will be incremented by 1 and its value will be 2. Then k loop will repeat 2 times. When i will be 3, k loop will repeat 3 times. So 3 digits will be printed. Now we have to identify the logic for printing digits. You can see in odd rows 1 is printed and in even rows 0s are printed and these odd and even can be identified with the value of i because i is representing row number. So here i can apply a condition if i modulus to 0. So if row number is completely divisible by 0 then it is even row otherwise it is odd. So if this condition is true then i am printing 0 otherwise i am printing 1. So this is the complete code for this k loop. After completion of k loop for new line i have to use a printer statement with slash n. So now this loop is completed. I am executing this code. Sorry i have not declared k here. I am entering 5s number of rows. You can compare the output. The required pattern is printed on console. So with this way the pattern can be printed with the help of this code. So i hope you have understood how you can print the required pattern with this code written in C. If you want to watch more programming related videos you can follow my youtube channel through this link that is youtube.com slash sanjaygupta underscore tech school. Thank you for watching this video.