sir i am not passing all test cases
Modula exponentiation
You need to change your approach a little bit…
Firstly you need to use long long int values…
Secondly… Use this approach in your function as ,
long long int result=1;
while(b>0)
{
if(b&1)
{
result=(resulta)%c;
}
a=(aa)%c;
b=b>>1;
}
cout<<result;
mam i was not able to understand the logic
I would suggest you to go through the online lectures on modular exponentiation in number theory section… The only thing you have to keep in mind is that You need to take mod value at every step… as its mentioned that you need to calculate a^b % c … so I have just used bitmasking for calculating power… and then taking mod…