Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

power function c++

#include <bits/stdc++.h>
using namespace std;
#define ll long long

ll power(ll a,ll b){
  ll ans = 1;
  while(b--){
    ans *= a;
  }
  return ans;
}

int main(){
  ll x,y;
  cin >> x >> y;
  ll x_power_y = power(x,y);
  cout << x_power_y << endl;
}
Source by www.cplusplus.com #
 
PREVIOUS NEXT
Tagged: #power #function
ADD COMMENT
Topic
Name
5+4 =