 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. That is youtube.com slash sanjaygupta underscore tech school. You can download my Android app that is Techimage based on programming available on Google Play. Now coming on to the topic. First time explaining the code which will display this first pattern. So here you can see I have declared some variables i, j and n. Then using scanf I am receiving number of rows which user want to print on console. Then first loop is starting from 1 and it will repeat n times. So suppose n is 5. So this i loop will repeat 5 times. First time its value is 1. So control will be transferred to J loop. J loop is starting from 1 and it is repeating i times. So first time this loop will repeat one time only. Here you can see if condition is available. So it is checking value of i. If it is even then 0 will be printed. If it is odd then 1 will be printed. So first time i is 1. So it is odd. So 1 will be printed. That is the requirement of this pattern. Then after completion of J loop new line will be displayed. Then i++ will be performed. So next second time i will become 2. So second time J loop will repeat 2 times starting from 1 to 2. And if condition will be true because i is now 2. So J loop will repeat 2 times. So if condition will be checked twice and both the times if condition will be true. So 0 will be printed 2 times. As you can see in the pattern 0 is required twice. Then third time i will become 3. So this time J will be repeating 3 times starting from 1 to 3. Then if condition this time it will be false because 3 is not divisible by 2. So J is repeating 3 times. So if will be checked 3 times. So 3 times 1 will be displayed on console. So this way if i execute this code and if i enter 5 you can see the first pattern is printing properly. Now i have to print this second pattern which is printing it in reverse order. So for that purpose i am changing in first loop. It is starting from n. Its condition is i greater than equals to 1 and instead of i++ i am using i minus minus. So suppose value of n is 5. So first time J loop will repeat 5 times from 1 to 5 because i is 5 and 5 is not divisible by 2. So if J are repeating 5 times. So if condition will be checked 5 times and every time it will be false. So 1 will be printed 5 times. Then i will become 4. So J loop will repeat 4 times and 4 is divisible by 2. So 0 will be printed 4 times. So this way reverse of the pattern will be displayed on console. Now again i am executing this code. I am entering 5. You can see the output. Reverse triangle is displayed on console which is printing 5.1 in first row. 4 zeros in second row and so on. So friends i hope you have understood how you can implement code to print above mentioned patterns in C programming with the help of nested loop and if else. This time i have used if else inside the inner loop of sorry inside the inner loop which is implemented with the 4 keyword. So i hope you have understood all the concepts. If you want to watch more programming related videos. You can open my youtube channel that is youtube.com slash sanjaygupta underscore tax school. Thank you for watching this video.