Download presentation
Presentation is loading. Please wait.
2
Introduction to Computers and Programming Lecture 10: For Loops Professor: Evan Korth New York University
3
Road map Nested for loops Reading: –Liang 6: Chapter 4: 4.6 –Liang 7: Chapter 4: 4.6
4
Nested For Loops It is also possible to place a for loop inside another for loop. int rows, columns; for (rows = 1; rows <= 5; rows++) { for (columns=1; columns<=10; columns++) System.out.print ("*"); System.out.println (); } Outer Loop Inner Loop Output:**************************************************
5
Nested For Loops, Example #2 int rows, columns; for (rows=1; rows<=5; rows++) { for (columns=1; columns<=rows; columns++) System.out.print ("*"); System.out.println (); } Output:*************** Outer Loop Inner Loop
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.