Write a program to nd the sum of the following series :
i.
x + x2 + x3 + x4
......... x
10
ii
5 + 10 + 15 + 20 ........ 100
Share
Write a program to nd the sum of the following series :
i.
x + x2 + x3 + x4
......... x
10
ii
5 + 10 + 15 + 20 ........ 100
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Answer:
i .
int x,n,i,s=0;
cin>>x>>n;
for(i=1;i<=n;i++)
s=s+x*i;
cout<<s;
ii.
int s=0,i;
for(i=5;i<=100;i+=4)
s+=i;
cout<<s;