# Fibonacci Series Program in Java

## A series of numbers in which each number ( Fibonacci number ) is the sum of the two preceding numbers. The simplest is the series 0, 1, 1, 2, 3, 5, 8, etc.

``````
import java.util.Scanner;

public class FibonacciSeries
{
public static void main(String[] args)
{
// TODO code application logic here
int n;
Scanner sc = new Scanner(System.in);
System.out.print("Enter number of series=");
n = sc.nextInt();
int a = 0,
b = 1, c;
for (int i = 1; i <= n; i++)
{
System.out.println(a);
c = a + b;
a = b;
b = c;
}
}
}
``````

#### Output:

```Enter number of series=10
0
1
1
2
3
5
8
13
21
34```
##### What is Fibonacci Series?
A series of numbers in which each number ( Fibonacci number ) is the sum of the two preceding numbers. The simplest is the series 0, 1, 1, 2, 3, 5, 8, etc.

##### What is Fibonacci Series in Java?
A series of numbers in which each number ( Fibonacci number ) is the sum of the two preceding numbers. The simplest is the series 0, 1, 1, 2, 3, 5, 8, etc.

b. tech. bca icse java java tutorials learn java mca programs