Prem_1997
9/16/2018 - 7:03 PM

power function

#include<bits/stdc++.h>
using namespace std;
float pow(int x,int y){
if(y == 0){return 1;}
float temp = pow(x,y/2);
if(y%2 == 0){
    return temp*temp;
}else{
    if(y > 0){
        return temp*temp*x;
    }else{
    return temp*temp/x;
    }
}
}
int main(){
    int x,y;
    cin >> x >> y;
    cout << pow(x,y) << endl;
}