The Fibonacci numbers are the numbers in the following integer sequence.

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ……..

In mathematical terms, the sequence F_{n} of Fibonacci numbers is defined by the recurrence relation

F_{n}= F_{n-1}+ F_{n-1}

with seed values

F_{0}= 0 and F_{1} = 1.

Given a number n, print n-th Fibonacci Number.

Input : n = 2 Output : 1 Input : n = 9 Output : 34

Below is the required implementation:

`declare` ` ` `-- declare variable first = 0, ` `-- second = 1 and temp of datatype number ` `first` `number := 0; ` `second` `number := 1; ` `temp` `number; ` ` ` `n number := 5; ` `i number; ` ` ` `begin` ` ` ` ` `dbms_output.put_line(` `'Series:'` `); ` ` ` `--print first two term first and second ` ` ` `dbms_output.put_line(` `first` `); ` ` ` `dbms_output.put_line(` `second` `); ` ` ` `-- loop i = 2 to n ` ` ` `for` `i ` `in` `2..n ` ` ` `loop ` ` ` `temp` `:=` `first` `+` `second` `; ` ` ` `first` `:= ` `second` `; ` `second` `:= ` `temp` `; ` ` ` `--print terms of fibonacci series ` ` ` `dbms_output.put_line(` `temp` `); ` `end` `loop; ` ` ` `end` `; ` `--Program End ` |

*chevron_right*

*filter_none*

Output:

0 1 1 2 3 5

## Recommended Posts:

- Prime numbers and Fibonacci
- Sum of numbers from 1 to N which are in Fibonacci Sequence
- Print numbers such that no two consecutive numbers are co-prime and every three consecutive numbers are co-prime
- Nth Term of a Fibonacci Series of Primes formed by concatenating pairs of Primes in a given range
- Maximum sum of distinct numbers such that LCM of these numbers is N
- Numbers less than N which are product of exactly two distinct prime numbers
- Absolute difference between the Product of Non-Prime numbers and Prime numbers of an Array
- Bitwise AND of the sum of prime numbers and the sum of composite numbers in an array
- Absolute difference between the XOR of Non-Prime numbers and Prime numbers of an Array
- Count of numbers upto M divisible by given Prime Numbers
- Count prime numbers that can be expressed as sum of consecutive prime numbers
- Program to find sum of prime numbers between 1 to n
- Python program to print all Prime numbers in an Interval
- Program to find Prime Numbers Between given Interval
- Program to print first N Prime numbers
- Program to find the LCM of two prime numbers
- C/C++ Program to find Prime Numbers between given range
- Almost Prime Numbers
- Least prime factor of numbers till n
- Find the prime numbers which can written as sum of most consecutive primes

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.