for (initialization_expression ; loop_condition ; increment_expression) {
// statements
}
public class MainClass {
public static void main(String[] args) {
int limit = 20; // Sum from 1 to this value
int sum = 0; // Accumulate sum in this variable
for (int i = 1; i <= limit; i++) {
sum = sum + i;
}
System.out.println("sum = " + sum);
}
}
sum = 210