Practice - Example 2: Printing a Right-Angled Triangle Pattern
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
What does a nested loop do in Java?
💡 Hint: Think about how many loops you see.
How many lines will the outer loop iterate if it runs from 1 to 5?
💡 Hint: Count the numbers from 1 to 5.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
How many times will the outer loop run in the example triangle printing program?
💡 Hint: Count how many iterations the outer loop is set.
The inner loop's execution is determined by which variable?
💡 Hint: Which loop affects the other?
1 more question available
Challenge Problems
Push your limits with advanced challenges
Create a program that uses nested loops to print a series of increasing and decreasing triangles. How would you implement this?
💡 Hint: Consider different conditions for the outer loop.
Modify the triangle printing example to also print each line number preceding the stars. How would that affect your nested loop?
💡 Hint: What additional output do you need to include inside the outer loop?
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.