int n = 4; int a = 0; int b = 1; int current = 1; while (n > 0) { a = b; b = current; current = a + b; n--; } System.out.println(current);