Cycles and iterations

Report a typo

Look at the following code:

class Main {
    public static void main(String[] args) {
        fibonacci();
    }

    static void fibonacci() {
        int prev = 0;
        int current = 1;
        for (int i = 0; i <= 25; i++) {
            int swap = prev;
            prev = current;
            current += swap;
            System.out.println(current);
        }
    }
}

What is the value of the current variable after it has been updated in the 20th iteration (i == 19)?

Enter a number
___

Create a free account to access the full topic