Menu

JAVA program to design Fibonacci series


class fibo
{
public static void main(String args[])
{
int prev, next, sum, n,a=0;
System.out.println(+a);
prev=next=1;
for(n=1;n<=10;n++)
{
System.out.println(prev);
sum=prev+next;
prev=next;
next=sum;
}
}
}

No comments:

Post a Comment