82 379
Assignments Done
100%
Successfully Done
In January 2020

# Answer to Question #17737 in C++ for Akhil Menon

Question #17737
Write a program in C++ having function sum sequence having two value parameters &lsquo;u&rsquo; and &lsquo;n&rsquo; with result type float .To find the sum of series given below:- 1-U+U^2/2!-U^3/3!+U^4/4!-&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;&hellip;..&plusmn;U^n/n!
1
2012-11-01T13:01:34-0400
#include <math.h>
#include <iostream>
using namespace std;

int factorial(int n) {
return !n ? 1 : n * factorial(n - 1);
& }
int main()
{
double s=0,a,z,x;
int u,n,i,j=0;

cout<<"enter u:";
cin>>u;
cout<<"enter n:";
cin>>n;

for(i=0;i<n;i++){
z=factorial(i);
cout<<"\n"<<z;
x=i/z;
cout<<"\n"<<x;
a=& pow(-1,i)*pow(u,x);
cout<<"\n"<<a;
s+=a;}
&
cout<<"\nS=& "<<s;
cout<<"\n\n";

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!