[Instructions] [Search] [Current] [Syllabus] [Links] [Handouts] [Outlines] [Labs] [More Labs] [Assignments] [Quizzes] [Examples] [Book] [Tutorial] [API]
Back to Conditionals. On to Building Graphical Programs.
Held Wednesday, February 3
Summary
for loops
while loops
Contents
Notes
while loops
and J5.3 covers for loops.
while (test) {
statements;
} // while
do {
statements
} while (test);
for (initialization; test; increment) {
statements;
} // for
initialization;
while (test) {
statements;
increment;
} // while (test)
/**
* Compute n!.
*/
public int factorial(int n) {
int i; // A counter variable
int factorial; // The factorial of n
factorial = 1;
for (i = 1; i <= n; i = i+1) {
factorial = factorial * i;
} // for
return factorial;
} // factorial(int)
var++.
for (i = 1; i <= n; ++i)
for (int i = 1; i <= n; ++i)
Do Lab J5: Control Structures for Repetition, Experiment J5.1.
count method look like?
readPass. How did you fix that
problem?
History
Back to Conditionals. On to Building Graphical Programs.
[Instructions] [Search] [Current] [Syllabus] [Links] [Handouts] [Outlines] [Labs] [More Labs] [Assignments] [Quizzes] [Examples] [Book] [Tutorial] [API]
Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.
This page may be found at http://www.math.grin.edu/~rebelsky/Courses/CS152/99S/Outlines/outline.07.html
Source text last modified Fri Mar 12 13:07:19 1999.
This page generated on Fri Mar 12 13:12:38 1999 by SiteWeaver. Validate this page's HTML.
Contact our webmaster at rebelsky@math.grin.edu