
Let me show it to you by printing i.ĭon’t worry if you are still a bit unsure about how this program is printing this pattern. The outer loop control variable i gives the row number. How should we write the inner loop so that it executes in this manner? Notice that the number of iterations of the inner loop per iteration of outer loop is equal to the row number. And for the fourth and final iteration of outer loop, inner loop should run 4 times. For the third iteration of outer loop, inner loop should run 3 times. For the second iteration of outer loop, inner loop should run twice. So, for the first iteration of outer loop, the inner loop should only run once.

In this pattern, the first row has 1 star, second row has 2 star and so on. The number of terms in each row for Right-angled triangle patterns varies with the rows whereas for rectangular patterns it was constant. So, the outer loop will run four times from 1 to 4 like this - for (int i = 1 i <= 4 i++) What is getting printed in the pattern.Like rectangular patterns, here also we will start by looking at the three basic things of the pattern that are: That’s why such patterns are called right-angled triangle based patterns. See these stars are forming a right-angled triangle. In case you have not yet watched the previous lesson of solving pattern programs, I strongly recommend you watch it and then start with this lesson.
Running bluej program how to#
It will show you how to write Java programs for Right-Angled Triangle patterns. This lesson builds upon the pattern programming concepts we learnt in the previous lesson. Nested for Loops Solving Pattern Programs - Part 2 ICSE Computer Applications
