76 309
Assignments Done
Successfully Done
In May 2019

Answer to Question #31117 in C++ for solomon

Question #31117
write a C++ program which will raise any number x to a positive power n using a for loop?
Expert's answer
#include <iostream>
#include <conio.h>

using namespace std;
//main function
int main()
int x,n,raise=1;//declare variable
cout<<"Enter x: ";
cin>>x;//read x
cout<<"Enter positive power n: ";
cin>>n;//read n
//raise any number x to a positive power n using a for loop
for(int i=0;i<n;i++){
//show result
cout<<x<<"^"<<n<<" =
return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


Assignment Expert
24.05.13, 15:54

You're welcome. We are glad to be helpful.
If you really liked our service please press like-button beside answer field. Thank you!

24.05.13, 15:36

i am appriciet your program.

Leave a comment

Ask Your question

Privacy policy Terms and Conditions