 Hello friends, I am Sanjay Gupta. In this video I am going to demonstrate you how you can display these patterns on console. Before starting you can note my information. You can follow or subscribe my youtube channel by this link that is youtube.com slash sanjaygupta underscore tech school. You can download my android app that is tech amaze based on programming which is available on google play. Now coming on to the topic for demonstration I have included a header file that is stdi.h. Inside main 3 variables are declared i, j and n. Printf will display this message on console and the number of rows will be received inside n using scanf. Then I have implemented this code in front of you. So first I am going to display first pattern. So for that purpose I have implemented this loop which is starting from 1 and it will repeat n times. Then for printing columns I have implemented second loop which is starting from 1 and it depends upon the value of i. So it repeats i time and if and else conditions are available. So here in this first pattern you can see odd rows are starting from 1 and even rows are starting from 0. So here if condition is available which is checking value of i, so if i is completely divisible by 2 then it will display even rows otherwise else will be printing odd rows. Now if we check even rows like this row here it is starting from 0 and then it will print 1. So odd positions are printing 0 and even positions are printing 1. So here j is divided by 2. If it is completely divisible then it will print 1 that is for even position and if it is not divisible by 2 then it will print 0 that is for odd positions. So with this way this if will print all even rows by printing 0 1 0 1 combination. Now for odd rows you can see for odd positions one should be printed and for even positions 0 should be printed. So here I have copied this condition and I have changed print f first it is printing 0 and then 1. So if this condition is true then it will print 0 otherwise it will print 1. So this way I have implemented this code so that first pattern can be displayed. You can see the output it is equivalent to first pattern. Now you can compare both the patterns both are same. Now if you want to print its reverse then you have to change only first loop. I have just changed first loop. By changing it this reverse pattern will be displayed on console. Again I am executing this code. You can compare the output. It is printing the same pattern as it is available here. So odd rows are starting from 1 and even rows are starting from 0. So friends this way you can implement both the patterns with the help of this code. If you want to watch more programming related videos you can follow my youtube channel that is youtube.com slash sanjaygupta underscore tech school. You can download my android app Techimist based on programming which is available on google play. Thank you for watching this video.