Showing wrong ans in many test cases

Tell me the error in my code as in some test cases its showing wrong ans

@Ramitgoel Please save your code on ide.codingblocks.com and share its link.

@pratyush63

@Ramitgoel your code is failing for large test cases. You have to print (a^b)mod c. The constraints given are 1<=a,b,c<=100000. So (a^b) can reach a very large value which cannot be handled by the datatype. This is why your code is giving wrong answer for many test cases. You have to handle those cases when a^b reaches a very large value.

So refer this video:

Hope this helps :slightly_smiling_face:

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.

1 Like