find fibonic series (using java)

// fibonic number 0,1,1,2,3,5..


 class fibonic

{

public static void main(String args[])

{

int a=0,b=1,sum=0;

System.out.println(a);

System.out.println(b);

for(int i=1; i<=n ; i++)

{

sum=a+b;

a=b;

b=sum;

System.out.println(sum);

}

}}


Comments

Popular posts from this blog