**Fibonacci series** is a series in which we have given the first two numbers and the next number sequence can be found using the sum of the two preceding ones. it is denoted by **Fn**. and the number in the Fibonacci series is called **Fibonacci numbers**.

This series is named for** Leonardo Pisano** an Italian mathematician. In Mathematics Fibonacci sequence is defined as

**a _{1} = 0, a_{2} = 1 and a_{n} = (a_{n-1}) + (a_{n-2}) where (n > 2)**

so the **Fibonacci sequence** is a series of numbers

Here

- the 3rd number is found by adding the two numbers before it (0 + 1).
- the 4th number is found by adding the two numbers before it (1 + 2) and soon.

**Note** – In modern mathematics, we can’t include 0.

**Fibonacci** was not the first to know about the **sequence**, it was known in India hundreds of years before it appears in the **Sanskrit prosody**.

## Use of the Fibonacci series in Real life

- When we make squares with those widths, we get a nice spiral. and this spiral is found in nature too.
- It is also used in coding and programming languages to solve practical problems.
- one of the main applications of
**Fibonacci**numbers is in the area of stock market analysis. we use it to estimate the price of a particular stock. - It is used to calculate the population of bees or rabbits.
- It is also used to estimate the complexity of a task.
- It is also used in mathematics to find solutions like Pascal’s triangle and Pythagorean triples.

One of the major facts is that when we calculate the ratio of two consecutive numbers then it is very close to the **Golden Ratio**. the bigger the pair of **Fibonacci numbers** the close the approximations to the **golden ratio**.

## First 10 Fibonacci numbers

let’s say a_{1} = a_{2} = 1 and to find the first 10 numbers we are going to use the formula (a_{n-1}) + (a_{n-2}) where (n > 2). always remember we need to have the first two numbers if we want to find the other sequence of the Fibonacci series.

a_{1} = 1 = a_{2}

a_{3} = 1 + 1 = 2

a_{4} = 1 + 2 = 3

a_{5} = 2 + 3 = 5

a_{6} = 3 + 5 = 8

a_{7} = 5 + 8 = 13

a_{8} = 8 + 13 = 21

a_{9} = 13 + 21 = 34

a_{10} = 21 + 34 = 55

### Program in C Programming

```
#include <stdio.h>
int main()
{
int a1 = 1;
int a2 = 1;
int s, next;
int i = 1;
printf("Enter length of fibonacci series: ");
scanf("%d", &s);
printf("%d\n%d \n", a1, a2);
for(i;i<s;i++){
next = a1 + a2;
printf("%d \n", next);
a1 = a2;
a2 = next;
next = 0;
}
return 0;
}
```

### Program in C++ Programming

```
#include <stdio.h>
int main()
{
int a1 = 1;
int a2 = 1;
int s, next;
int i = 1;
printf("Enter length of fibonacci series: ");
scanf("%d", &s);
printf("%d\n%d \n", a1, a2);
for(i;i<s;i++){
next = a1 + a2;
printf("%d \n", next);
a1 = a2;
a2 = next;
next = 0;
}
return 0;
}
```

### Program in Java programming

```
import java.util.*;
public class random {
public static void main(String[] args) {
int i = 1, t1 = 0, t2 = 1;
System.out.print("Enter length of Series: ");
Scanner sc=new Scanner(System.in);
int n = sc.nextInt();
System.out.print("First " + n + " terms: ");
while (i <= n)
{
System.out.print(t1 + "\n ");
int sum = t1 + t2;
t1 = t2;
t2 = sum;
i++;
}
}
}
```

### Program in Python Programming

```
n = int(input("How many terms? "))
n1, n2 = 0, 1
count = 0
if n <= 0:
print("Please enter a positive value")
elif n == 1:
print("Fibonacci sequence upto",n,":")
print(n1)
else:
print("Fibonacci sequence:")
while count < n:
print(n1)
nth = n1 + n2
n1 = n2
n2 = nth
count += 1
```

**Read other Tutorials**