Modular exponentiation

https://ide.codingblocks.com/s/40960
my code for https://hack.codingblocks.com/contests/c/537/743
It is not passing all test cases.

pls explain what’s wrong

thanks

Heyy apoorva ! actually the issue is you have to take mod at each step of exponentation because it may happen , at some times your answer gets out of integer range.
Debug your code with a=10 b=1024 c=1000000 for each iteration, you will undertand your mistake .
If you will have doubt still, then take a look on this code , i have corrected your code here
https://ide.codingblocks.com/s/40968

1 Like

Hey, I was thinking the same, but was unsure.

Thank you for such a prompt response:)

1 Like

it doesn’t however work for numbers of order 10^10^5 . How to write its code please let me know asap .