java-tutorialsmade

Java program to print Fibonacci series

In this example I’m going to show you how to write a program to print Fibonacci series in Java.

The same Fibonacci programme is written in other languages such as C and JavaScript, search “fibonacci” in the search field to find those. Soon I will be writing in all other programming languages too.

If you already don’t have knowledge about Fibonacci, here is a simple explanation,

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

0,1 -> 0 +1 =1 ( 1 is the next number)
0,1,2 -> 1+1 = 2 (2 is the next number)
0,1,2 -> 1+2 = 3
0,1,2,3 -> 2+3 = 5

So basically Fibonacci series is finding the next number by adding the previous two numbers.

Here is the Java Program to print Fibonacci series:

The output of the program will be:

Enter the limit: 6
0
1
1
2
3
5

Keep learning, update your knowledge daily!

Related Posts

Leave a Reply