Answer to Question #19553 in C++ for mounisha

Question #19553
write a c++ program 1)that calculates and prints sum of integers from 1 to 10
2)to calculate x raised to the power y
1
Expert's answer
2012-11-27T09:52:59-0500
#include "iostream"
using namespace std;

int main()
{ int s=0;
& for(int i=1;i<11;i++)
& s+=i;
cout<<" sum of integers from 1 to 10 : "<<s<<endl;

system ("PAUSE");

}








#include "iostream"
using namespace std;

int main()
{ int x,y,s=1;
cout<<"Enter X: ";
cin>>x ;
cout<<"Enter Y: ";
cin>>y;
for (int i=1;i<(y+1);i++)
s*=x;
cout<<"X raised to the power Y : "<<s<<endl;

system ("PAUSE");

}

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS