`

Inline Code Example Here
#include <iostream>
#include <cmath>
using namespace std;
int main() {
        int n = 0;
      double x,sn=0,snm1 =1,tn=1,tnm1=1,diff;

    cout << "Enter a value x which is -1< x <1"<< "\n";
    cin >>x;
    tnm1=1;
    do{

    tn = -1*((4*(n-1))-1)/(4+(4*(n-1)))*x*tnm1;
        snm1=tn+tnm1;
    sn = snm1 + sn;

       diff= fabs(sn-snm1);
        snm1=sn;
        tn=tnm1;

        n++;
    cout<<sn<<"   " << diff <<"\n";
    }while(diff>=0.0001);
    }

Problem 3. The Taylor series expansion at x = 0 of (1+

This is the question for those who are wondering:
Problem 3. The Taylor series expansion at x = 0 of (1+

What is your problem?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.