Find the Nth term in the Fibonacci series.
Note: Here Fibonacci series starts with 1 not with 0 {1,1,2,3,5}.
Input Format :
Output Format :
Explanation of Input :
Sample Input :
Sample Output :
Solution :
- N = int(input())
- temp = 1
- a = 1
- b = 0
- c = 0
- if N == 1:
- c = 1
- else:
- while temp < N:
- c = a + b
- b = a
- a = c
- temp = temp + 1
- print(c)
Tags:
Solutions