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

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