power of number
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;
}
power of number
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;
}
power of a number
#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;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us