65 767
Assignments Done
99,4%
Successfully Done
In October 2018

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

Question #17737
Write a program in C++ having function sum sequence having two value parameters ‘u’ and ‘n’ with result type float .To find the sum of series given below:-
1-U+U^2/2!-U^3/3!+U^4/4!-……………………………………………………………..±U^n/n!
Expert's answer
#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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions