Here is the program for display fibonacci series in JAVA.
------------------------------------------------------------------------------------------------------------
class A
{
int a,b,c;
A ()
{
a = 1;
b = 0;
}
void create ( int n )
{
for ( int i=0 ; i<n ; i++ )
{
c = a + b;
System.out.print(b + " ");
a = b;
b = c;
}
}
}
class Fibonacci
{
public static void main ( String args[] )
{
int m = Integer.parseInt ( args[0] );
A a = new A();
System.out.println("\n\nFibonacci Series - \n\n");
a.create( m );
System.out.println("\n");
}
}
------------------------------------------------------------------------------------------------------------
class A
{
int a,b,c;
A ()
{
a = 1;
b = 0;
}
void create ( int n )
{
for ( int i=0 ; i<n ; i++ )
{
c = a + b;
System.out.print(b + " ");
a = b;
b = c;
}
}
}
class Fibonacci
{
public static void main ( String args[] )
{
int m = Integer.parseInt ( args[0] );
A a = new A();
System.out.println("\n\nFibonacci Series - \n\n");
a.create( m );
System.out.println("\n");
}
}
------------------------------------------------------------------------------------------------------------
IF YOU HAVE ANY QUERY THAN CONTACT US OR GIVE YOUR QUERY IN THE QUERY OPTION.
GOOD LUCK