For loop with int value type as the control
#include <iostream>
using namespace std;
int main()
{
int b, e, r;
cout << "Enter base: ";
cin >> b;
cout << "Enter exponent: ";
cin >> e;
r = 1;
for( ; e; e--)
r = r * b;
cout << "Result: " << r;
return 0;
}
Related examples in the same category