class Solution { public: double Power(double base, int exponent) { double ans=1; if(exponent>=0) { for(int i=0;i<exponent;i++) { ans*=base; } return ans; } exponent=-exponent; for(int i=0;i<exponent;i++) { ans/=base; } return ans; } };