10th tutorial for right angle triangle patterns



This is another pattern for right angle triangle using numbers. In this pattern numbers are arranged in reverse order i.e. as 54321.




Pattern looks like can be made by varying in loop conditions.



Now here as we have to reverse the order of numbers to be printed so we have to change the conditions of inner loop.




As you can see in program the inner loop i.e. j loop is decremented as 54321 is to be printed in reverse order.
for(j=i;i>=1;j--)

Thus how loop is changed. j is initialised by assigning the i value, the loop will execute till it is equal or greater than 1.

Here printf statement remains same as of last tutorial (pattern n2).


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

Post a Comment