Created
February 4, 2012 18:07
-
-
Save rolisz/1739257 to your computer and use it in GitHub Desktop.
Rezolvare problema 9 subiect FP
This file contains 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
def pow(x,n): | |
if n==0: return 1 | |
if n==1: return x | |
res = x | |
i = 2 | |
while i<= n : | |
if 2*i < n: | |
res = res * res | |
res = res * x | |
i = i + 1 | |
return res |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment