In mathematics, the Fibonacci numbers, commonly denoted Fₙ form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is, and for n > 1. One has F₂ = 1.

**Fibonacci Sequence** is the series of numbers:

1 2 3 | 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, ... |

- The 2 is found by adding the two numbers before it (1+1)
- The 3 is found by adding the two numbers before it (1+2),
- And the 5 is (2+3),
- and so on!

Program: Fibonacci Series in Java Without Recursion

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | class FibonacciExample1{ public static void main(String args[]) { int n1=0,n2=1,n3,i,count=10; System.out.print(n1+" "+n2);//printing 0 and 1 for(i=2;i<count;++i)//loop starts from 2 because 0 and 1 are already printed { n3=n1+n2; System.out.print(" "+n3); n1=n2; n2=n3; } }} |

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

- How to delete folder and sub folders using Java
- Java program to calculate power of a number
- How to remove duplicate characters from String in Java?
- Iterate value through Java HashMap
- Java program to remove punctuation from a given string
- Java Program to Implement Fisher-Yates Algorithm for Array Shuffling
- Java Program to Implement Gauss Seidel Method
- Java Program to Implement Gauss Jordan Elimination
- A Simple Merge based O(n) solution to find median of two sorted arrays
- Java program to count islands in boolean 2D matrix

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok