 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can print these two patterns in C programming. Before starting, you can note my information. You can follow or subscribe my YouTube channel by following this link, which is youtube.com slash sanjaygupta underscore tech school. You can download my Android app that is Techimace available on Google Play. Now coming onto the topic, I have included a header file stdio.h for demonstration. Then inside main three variables i, j, n are declared. Then printf will display this message on console. Then number of rows will be received by n variable using scanf. Then for printing first pattern, I have implemented combination of loops that is starting from 1 to n. So this loop will repeat n times. So suppose value of n is 5. So first time i is 1, so this j loop will repeat 1 time. So here on the basis of j, j is divided by 2 and its remainder is checked with 0. So if remainder of j is 0, then it will print 0 on console, otherwise it will display 1 on console. Whenever value of j will be odd like 1, 3, 5, then it will be displaying 1. And if it is even like 2, 4, 6, then it will be displaying 0. So with the help of j, 0 and 1 are displayed on console. So first time executing this code, I am entering 5. You can see the output. It is matching with this first pattern. Now I am going to display reverse of this pattern. In this pattern, first row is containing 5 element, then second row is containing 4 and so on. So for this purpose, you just have to change first loop. So it is initialized with n. So i equals to n. Condition is i greater than equals to 1 and i minus minus. So here if n is 5 first time, so this j loop will repeat 5 times because value of i is 5. So 5 times if condition will be checked. So whenever value of j is odd, then this condition will be false. So it will display 1 and if j is even, then this condition will be true. So it will display 0 on console. So by changing in i loop, this reverse pattern will be displayed on console. I am entering 5 as number of rows. You can see the output and you can compare it with this pattern. So with the help of this code, I am able to display both the patterns. I have just changed i loop for printing reverse. If you want to print first pattern, you can change this i loop again starting from 1 to n. So friends, I hope you have understood how you can print both the patterns in C programming with the help of nested loop. If you want to watch more programming related videos, you can follow my YouTube channel by this link that is youtube.com. Thank you for watching this video.