Skip to content
CodeKruPro

Variables that live only inside a loop

Predict the outputEasyJava only
Main.java
public class Main {
    public static void main(String[] args) {
        int total = 0;
        for (int i = 1; i <= 3; i++) {
            int square = i * i;
            total += square;
        }
        System.out.println(total);
        int i = 100;
        System.out.println(i);
    }
}

Graded by exact match. Spaces at the ends of lines and blank lines at the end do not count.

to answer and keep your progress. Reading is free for everyone.