Guest User

Untitled

a guest
Oct 22nd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. def square_expo(x, n):
  4. if n == 0:
  5. return 1;
  6.  
  7. if n % 2 == 0:
  8. return square_expo(x * x, n // 2)
  9.  
  10. return x * square_expo(x * x, n // 2)
  11.  
  12. x = int(input("x = "))
  13. n = int(input("n = "))
  14.  
  15. print(square_expo(x, n))
Add Comment
Please, Sign In to add comment