# Answer to Question #43137 in C++ for sanoop lal

Question #43137

1 - u + u^3/2! - u^5/3! + ... + (-1)^(2n-1) u^(2n-1)/n!

Expert's answer

`#include <iostream>`

#include <math.h>

#include <conio.h>

using namespace std;

int main(){

int n;

double u;

cout<<"n = ";

cin>>n;

cout<<"u = ";

cin>>u;

double sum = 1.0;

double value = u;

for (int i = 1; i <= n; ){

sum += pow(-1.0, (double)i)*value;

value *= u*u/(++i);

}

cout<<"answer = "<<sum<<endl;

getch();

return 0;

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment