1 / 3
Jun 2018

what is wrong with my code, i am getting correct output without runtime error

#include
#include <math.h>
using namespace std;

int main() {
// your code goes here
long long int a,b,c,t,ld;
cin>>t;
while(t–)
{
cin>>a>>b;
if(a==0 &&b==0)
{
ld = 1;
}
else if(b==0)
{
ld = 1;
}
else if(a==0)
{
ld = 0;
}
else
{
c = pow(a,b);
ld=c%10;
}
cout<<ld<<endl;
}

return 0;

}

  • created

    Jun '18
  • last reply

    Jun '18
  • 2

    replies

  • 784

    views

  • 2

    users

c = pow(a,b)
what will happen when
a = 20 and b = 2,147,483,000
i think it will be overflow…

Suggested Topics

Topic Category Replies Views Activity
C and C++ 0 17 10d

Want to read more? Browse other topics in C and C++ or view latest topics.