Hello, tell me please. There is a workable code that displays Fibonacci numbers:
public class Fibonachi2 { public static void main(String[] args) { int[] a = new int[10]; a[0] = 1; a[1] = 1; for(int i = 0; i < a.length; i++) { if(i > 2) { a[i] = a[i - 2] + a[i - 1]; System.out.print(a[i] + " "); } } } }
Result: 1 1 2 3 5 8 13
But I'm interested in how he displays the first two units? After all, according to the condition:
if(i > 2) { a[i] = a[i - 2] + a[i - 1]; System.out.print(a[i] + " "); } it must display the elements on the screen, starting with 4 elements of the array (System.out.print (a [3] + ""); etc.).