Let's suppose we have a BASE & POWER and user have to enter BASE and POWER, After he enter that, the BASE will be Multiply using Loop to multiply with it's power,
after that we'll use do while loop for the cout of The Answer is?
Do anyone can help with this coding?
BASE = 5
POWER = 3
cout << "Enter Base= ";
cin >> b;
cout << "Enter Power= ";
cin >> p;
for(i=1; i=<p; i++)
{
ans = a x b
etc........
..........
....
while {
cout << "The Answer is= "
Something like that I can't complete this please help
#include <iostream>
usingnamespace std;
int main()
{
int a, b , c;
int d=1;
char e;
do
{
cout<<"enter base : ";
cin>>a;
cout<<"enter power : ";
cin>>b;
for (c=1;c<=b;c++)
{
d=d*a;
cout<<"the answer ="<<d;
}
}
cout<<"Enter n to exit or others to continue";
cin>>e;
while(e!='n')
}
#include <iostream>
usingnamespace std;
void main()
{
char ch;
do
{
int x, y, z;
int a = 1;
cout << "Enter the Value of Base: ";
cin >> x;
cout << "Enter the Value of Power: ";
cin >> y;
for (z = 1; z <= y; z++)
{
a = a*x;
}
cout << "Your Answer= " << a << endl;
cout << "Do you want to Continue? y/n:";
cin >> ch;
} while (ch != 'n');
}
#include <iostream>
#include <math.h>
usingnamespace std;
int main()
{
char ch;
do
{
int x, y, a;
cout << "Enter the Value of Base: ";
cin >> x;
cout << "Enter the Value of Power: ";
cin >> y;
a = pow(x, y);
cout << "Your Answer= " << a << endl;
cout << "Do you want to Continue? y/n:";
cin >> ch;
} while (ch != 'n');
}