We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Math
- Power - Mod Power
- Discussions
Power - Mod Power
Power - Mod Power
Sort by
recency
|
322 Discussions
|
Please Login in order to post a comment
Here is HackerRank Power - Mod Power in Python solution - https://programmingoneonone.com/hackerrank-power-mod-power-solution-in-python.html
a=int(input()) b=int(input()) m=int(input()) print(f"{pow(a,b)}\n{pow(a,b,m)}")
just 4 lines
For Python3
import math from math import pow
a=int(input()) b=int(input()) m=int(input()) print(int(pow(a,b))) print(a**b %m)