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
|
318 Discussions
|
Please Login in order to post a comment
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)
For Python3
I guess this is as simple as it can get. If anyone didn't understand, feel free to comment and I will try to explain
a=int(input()) b=int(input()) m=int(input()) print(pow(a,b)) print(pow(a,b,m))
import math a = int(input()) b= int(input()) m = int(input()) d = math.pow(a,b) print(math.floor(d)) mod = d % m print(math.floor(mod))