C++ Programming Code Examples C++ > Recursion Code Examples C++ Program to Calculate Power Using Recursion C++ Program to Calculate Power Using Recursion This program calculates the power of a number using recursion where base and exponent is entered by the user. This technique can only calculate power if the exponent is a positive integer. To find power of any number, you can use pow() function. result = pow(base, exponent); #include <iostream> using namespace std; int calculatePower(int, int); int main() { int base, powerRaised, result; cout << "Enter base number: "; cin >> base; cout << "Enter power number(positive integer): "; cin >> powerRaised; result = calculatePower(base, powerRaised); cout << base << "^" << powerRaised << " = " << result; return 0; } int calculatePower(int base, int powerRaised) { if (powerRaised != 1) return (base*calculatePower(base, powerRaised-1)); else return 1; }