The Fibonacci series is a series where the next term is the sum of pervious two terms. The first two terms of the Fibonacci sequence is 0 followed by 1.
The Fibonacci sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, ...
public class fibonacci {
public static void main(String[] args) {
int f=0,s=1,t,i,count=10;
System.out.print(f+" "+s);
for(i=2;i
{
t=f+s;
System.out.print(" "+t);
f=s;
s=t;
}
}
}
0 Comments