Fibonacci numbers are strongly related to the golden ratio: Binet's formula expresses the nth Fibonacci number in terms of N and the golden ratio, and imply that the ratio of two consecutive Fibonacci numbers tends to the golden ratio as n increases. In his 1202 book Liber Abaci, Fibonacci introduced the sequence to Western European mathematics, although the sequence had been described earlier in Indian mathematics, as early as 200 BC in work by Pingala on enumerating possible shapes of Sanskrit poetry formed from syllables of two lengths. At the end of the nth month, the number of pairs of rabbits is equal to the number of mature pairs (that is, the number of pairs in month N – 2) plus the number of pairs alive last month (month N – 1). At the end of the fourth month, the original pair has produced yet another new pair, and the pair birth two months ago also produces their first pair, make 5 pairs. Fibonacci considers the increase of an idealized (biologically unrealistic) rabbit population, assume that: a newly birth breeding pair of rabbits are put in a field; each breeding pair mates at the age of one month, and at the end of their second month they always produce another pair of rabbits; and rabbits never die, but continue breeding forever.

COMING SOON!

```
#include <iostream>
using namespace std;
int fib(int n)
{
int res[3];
res[0] = 0;
res[1] = 1;
for (int i = 2; i <= n; i++)
{
res[2] = res[1] + res[0];
res[0] = res[1];
res[1] = res[2];
}
return res[1];
}
int main(int argc, char const *argv[])
{
int n;
cout << "Enter n: ";
cin >> n;
cout << "Fibonacci number is ";
cout << fib(n) << endl;
return 0;
}
```