Skip to content

Instantly share code, notes, and snippets.

@binhngoc17
Created December 13, 2014 04:19
Show Gist options
  • Save binhngoc17/6754cb9077417bbe9580 to your computer and use it in GitHub Desktop.
Save binhngoc17/6754cb9077417bbe9580 to your computer and use it in GitHub Desktop.
Calculating Fibonacci number
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