Next: Example while loop: Summing
Up: The while statement
Previous: The while statement
The following while
statement prints out the numbers 1 to 10,
each on a new line.
int i; i = 1; while (i <= 10) { cout << i << endl; i++; }
Download program.