Fibonacci Series – Java

Fibonacci Series :

In this, a term in series is given by the sum of its two preceding terms.

Following series is a Fibonacci series :

0, 1, 1, 2, 3, 5, 8……………………

Source Code :

Following is the source code in java to print first n terms in a fibonacci series :

Sample Output :

Enter the number of terms :
23
Fibonacci Series is :
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711

Leave a Reply

Your email address will not be published. Required fields are marked *