16th tutorial for right angle triangle patterns



This is another pattern for printing 1 0 1 0 in another way that we have already seen in earlier tutorial. Here also logic remains same just conditions for loop changes.




In this pattern there is one little difference than the tutorial 14 in which 1 was arranged in diagonal form while here we have to arrange 1 in vertical columns than column of 0 in right angle triangle form only. Pattern looks like:




The logic of performing this pattern in program is same. Just we need to do some changes in for loop.



As we can see here the inner loop is changed and is same as that we have seen in our first program of ‘*’.
for(j=1;j<=i;j++)

Thus how loop is written which is very simple and easy to implement. The first loop we have learn is the same loop so it is very easy to understand this.

Here printf statement remains same as that of tutorial 14(pattern no n15).



{ 0 comments ... read them below or add one }

Post a Comment