#include <iostream>
#include <cmath>
int power(int base, int exp); // return base to the power of exponent
// where base and exp are members of Integers
usingnamespace std;
int main()
{
cout << power(3,2) << endl;
cout << power(4,1) << endl;
cout << power(5,0) << endl;
cout << power(-2,2) << endl;
cout << power(-2,3) << endl;
cout << power(-2,-2) << endl; // Out put here is 0
cout << power(-2,-4) << endl; // Out put here is 0 as well.
}
int power(int base, int exp)
{
if(exp == 0)
return 1;
elseif(exp > 0)
return base * power(base,exp-1);
elsereturn 1.0 /(base * power(base,abs(exp)-1));
}