First, we get the height of the pyramid rows from the user. In the first loop, we iterate from i = 0 to i = rows . In the second loop, we print numbers starting from 1 to j , where j ranges from 0 to i . After each iteration of the first loop, we print a new line.