Modular exponentiation

https://ide.codingblocks.com/s/254977 i am not able to pass all test case plz help me out in my approch

Hello @anuragavm123,

Your code won’t work for the given constraints:
1<=a,b,c<=100000
Reason:

So, use an optimized way to compute it.

Think of a different way to calculate modular exponential.
Hint: study about exp by squaring method algorithm.
Refer to the below-mentioned link for details:

GeeksforGeeks – 11 Nov 17

Hope, this would help.
Give a like if you are satisfied.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.