Skip to content

Commit 674a20d

Browse files
committed
last fibo no added
1 parent 445346d commit 674a20d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Problem Description
2+
# Task. Given an integer ??, find the ??th Fibonacci number ????.
3+
# Input Format. The input consists of a single integer ??.
4+
# Constraints. 0 = ?? = 45.
5+
# Output Format. Output ????.
6+
# Time Limits.
7+
# language C C++ Java Python C# Haskell JavaScript Ruby Scala
8+
# time (sec) 1 1 1.5 5 1.5 2 5 5 3
9+
# Memory Limit. 512MB.
10+
11+
12+
13+
14+
15+
n = int(raw_input())
16+
17+
def fibo(n):
18+
if n<=1:
19+
return n
20+
else:
21+
previous = 0
22+
current = 1
23+
for _ in range(n-1):
24+
previous, current = current, previous+current
25+
return current%10
26+
27+
28+
29+
print fibo(n)

0 commit comments

Comments
 (0)