Saturday 17 November 2012

PROGRAM FOR FIBONACCI SERIES IN JAVA

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");

        }

}

------------------------------------------------------------------------------------------------------------






IF YOU HAVE ANY QUERY THAN CONTACT US OR GIVE YOUR QUERY IN THE QUERY OPTION.      
                                                            GOOD LUCK

More embedded projects >>....                             More MAT LAB projects>>...