/* Finish this program that computes x^n. To do so, write a recursive function: int pow(int x, int n); */ #include using namespace std; int pow(int x, int n); int main() { // Get inputs int x, n; cout << "Enter x: "; cin >> x; cout << "Enter n: "; cin >> n; cout << x << "^" << n << " is " << pow(x,n) << endl; return 0; } // Compute x^n int pow (int x, int n) { cout << "compute pow( " << x << "," << n << ")" << endl; //base case if(n==0) return 1; //recursive case int ans = x* pow(x, n-1); return ans; }