Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Computers and Programming Lecture 10: For Loops Professor: Evan Korth New York University.

Similar presentations


Presentation on theme: "Introduction to Computers and Programming Lecture 10: For Loops Professor: Evan Korth New York University."— Presentation transcript:

1

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


Download ppt "Introduction to Computers and Programming Lecture 10: For Loops Professor: Evan Korth New York University."

Similar presentations


Ads by Google