Nth Fibonacci number

Level EASY

Nth term of fibonacci series F(n) is calculated using following formula -

    F(n) = F(n-1) + F(n-2), 
    Where, F(1) = F(2) = 1

Provided N you have to find out the Nth Fibonacci Number.

Input Format :
Integer n
Output Format :
Nth Fibonacci term i.e. F(n)
Constraints:
1 <= n <= 25
Sample Input 1:
4
Sample Output 2:
3 
Sample Input 1:
6
Sample Output 2:
8

Comments

Popular posts from this blog

How to pass parameters in webhook?

Access and modify all the resources of our Wiki.js using WikiJS API

Fahrenheit to Celsius