public class FirstTenEvenIntegers
{
public static void main(String [] args)
{
//variable declaration
int i; //loop counter
int endValue = 20; //set to last even value to be considered
//loop from first even value to tenth even value, inclusive
for(i = 2; i <= endValue; i++)
{
if(i % 2 == 0) //test for an even value
System.out.println(i); //if even, display the value
}
}
}
2
4
6
8
10
12
14
16
18
20