Selection Structure and Conditions 1

Selection Structure and Conditions

for (int i=0; i<=20; i+=4) {
   System.out.print(i + " ");
}

Here is what the above code is Doing:
1. The for loop starts with the initialization of the variable i to 0.
2. The condition is i <= 20. 3. The increment is i += 4. 4. The body of the loop prints the value of i. The output of the above code is: 0 4 8 12 16 20

Similar Posts