Created
December 13, 2014 04:19
-
-
Save binhngoc17/6754cb9077417bbe9580 to your computer and use it in GitHub Desktop.
Calculating Fibonacci number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
A, B, N = [int(i) for i in sys.stdin.readline().split(' ')] | |
a_n = A | |
a_n_1 = B | |
t = 2 | |
while t < N: | |
i = a_n | |
a_n = a_n_1 | |
a_n_1 = a_n**2 + i | |
t += 1 | |
print a_n_1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment