Why this code gives error?
#include
#include
using namespace std;
int main() {
long int a,b,c;
cin>>a>>b>>c;
cout<<pow(a,b)%c<<endl;
return 0;
}
While the following code executes correctly for some test cases (but not for all) and the difference is only that, in the following code I am taking another variable ‘res’:
#include
#include
using namespace std;
int main() {
long int a,b,c,res;
cin>>a>>b>>c;
res=pow(a,b);
res=res%c;
cout<<res<<endl;
return 0;
}
what would be the possible correction for this code?