MODULAR EXPONENTIAATION

SIR,My code is failing 6 out of 10 cases.
please give me some hint or help me sir.

hello @aryan2909
image

here use
p=(p*a)%c;

a=(a*a)%c.

actually it is a very popular technique called modular exponentiation.
read about it from here-> modular exponentiation