i = start_value; while ( i <= end_value ) { ... (do something with the i^{th} item)... i++; } 
start_value, start_value+1, start_value+2, ....., end_value
for each value f from 2 to n  1 do: { compute n % f if (at least one remainder "n % f" is 0) then n is not prime else n is prime } 
boolean isPrime; isPrime = true; // Assume that n is prime... for each value f from 2 to n  1 do: { if (n % f == 0) then isPrime = false; // Now we know n is NOT prime... } 
boolean isPrime; int f; isPrime = true; // Assume that n is prime... f = 2; while ( f <= n  1 ) { if (n % f == 0) then isPrime = false; // Now we know n is NOT prime... f++; } 
We will now learn the for statement that let us write the prime number program with more clarity.
for ( initialization ; condition ; update ) ONEsinglestatement // For body 
When you have written enough FOR statements, I am sure that you will not only memorize this syntax, but can use it effectively.

boolean isPrime; isPrime = true; // Assume that n is prime... for each value f from 2 to n  1 do: { if (n % f == 0) then isPrime = false; // Now we know n is NOT prime... } 
boolean isPrime; int f; isPrime = true; // Assume that n is prime... for ( f = 2; f <= n  1 ; f++ ) { if (n % f == 0) then isPrime = false; // Now we know n is NOT prime... } 
n ! = 1 * 2 * 3 * ... * n 
fac = 1; for ( i starting from 1 to n ) { fac = fac * i; } 
fac = fac * i = 1 * 1 = 1
fac = fac * i = 1 * 2 = 2
fac = fac * i = 2 * 3 = 6
fac = fac * i = 6 * 4 = 24
int i; int fac; fac = 1; for ( i = 1; i <= n; i++ ) { fac = fac * i; } 
int i; for ( i = 0; i < 10; i++ ) { System.out.println( i ); } 
Answer:
0 1 2 3 4 5 6 7 8 9
int i; for ( i = 0; i < 10; i++ ) { System.out.println( i ); i++; } 
Answer: i is increased by 2 each time !
0 2 4 6 8
for ( i = 0; i < 10; i++ ); System.out.println( i ); 
Answer:
The program is read as: for ( i = 0; i < 10; i++ ) ; System.out.println( i ); The program will therefore print: 10 (Because i = 10 when the for loop stops)