#include
using namespace std;
int main() {
int a,b,c;
cin>>a>>b>>c;
a=a%c;
int res=1;
while(b>0)
{
if(b&1)
{
res=(res*a)%c;
}
b=b>>1;
a=(a*a)%c;
}
cout<<res;
return 0;
}
#include
using namespace std;
int main() {
int a,b,c;
cin>>a>>b>>c;
a=a%c;
int res=1;
while(b>0)
{
if(b&1)
{
res=(res*a)%c;
}
b=b>>1;
a=(a*a)%c;
}
cout<<res;
return 0;
}
Manish, pls use long long int a,b,c and long long int res=1 in your code and then try to submit the code…
Since you arent replying anything, I am marking this doubt as resolved… You can reopen it if u still face any issues…