Please tell me doubt in this one


Please tell me ASAP.

you need to take modulo while performing multiplication in the function:

Sir can we do like we first calculate a^n and then do modulus with e in the main only.
Will it be Okay?

no, a^n can easily exceed the range of long long int, you need to take modulo e at every multiplication

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.