f[0] = 1;
f[1] = 1;
int x;
System.out.prin t(f[0] + "\n" + f[1] + "\n");
for(x=2; x<=45; x++)
f[x] = f[x-1] + f[x-2];
System.out.prin tln(f[x]); [/CODE]
i cant understand that how it hows after for statement.it first print 1,1 and then 2.the thing emm not getting is that how it print 2.iknown that in fibonacci number next number is the sum of previous two number but didnt get that how it print 2 and then 5 and so on.please let me explain.
f[1] = 1;
int x;
System.out.prin t(f[0] + "\n" + f[1] + "\n");
for(x=2; x<=45; x++)
f[x] = f[x-1] + f[x-2];
System.out.prin tln(f[x]); [/CODE]
i cant understand that how it hows after for statement.it first print 1,1 and then 2.the thing emm not getting is that how it print 2.iknown that in fibonacci number next number is the sum of previous two number but didnt get that how it print 2 and then 5 and so on.please let me explain.
Comment