Here is how to do simple exponential calculations using loops in C++ language.

[sourcecode language=’cpp’]

#include

void main()

{

int power=1;

int a,b;

cin>>a>>b;

for (int i=1;i<=b;i++)
{
power *=a;
}
cout<
**Instructions:**

- First we take an integer variable power and assign it a value of
**1**(why? this is because this variable will be involved in calculations and if we take it as 0, all the results will turn out to be 0) - Next we take the values of two integer variables from the user. One is
**‘a’**which will act as the base and the other is**‘b’**which will be the power of**‘a**‘. Therefore in mathematical terms, this will look like a^{b}. - Now we start a for loop which will run the number of times b is. And it will store the value of calculation in the variable power. The calculation involves the multiplication of power * a until the value of i becomes greater than b(Where the loop will automatically exit).
- Next we display the value of power using cout statement.