poder de número
double Pow(double x, int n)
{
double ans=1.0;
while(d>0)
{
if(d&1==1)
ans*=x;
d>>=1;
x*=x;
}
return ans;
}
PrashantUnity
double Pow(double x, int n)
{
double ans=1.0;
while(d>0)
{
if(d&1==1)
ans*=x;
d>>=1;
x*=x;
}
return ans;
}
#include <iostream>
using namespace std;
long long binpow(long long a, long long b) {
if (b == 0)
return 1;
long long res = binpow(a, b / 2);
if (b % 2)
return res * res * a;
else
return res * res;
}
int main()
{
long long x = 5;
long long y = 16;
cout << "Power is " << binpow(x, y);
return 0;
}