How to find this series without using power function in c
1+x/1!+x2/2!+x3/3!+x4/4!
please help me out i'm unable to solve these type of questions

Recommended Answers

All 3 Replies

Member rules - Keep It Organized : Do provide evidence of having done some work yourself if posting questions from school or work assignments

Try something like that:

// power series dev using a loop
// value of e = 2.71828182846 

#include <stdio.h>

int main()
{
    int n, f;
    float x;
    float e;

    x = 1.0;
    f = 1;
    e = 0.0;
    //e = 1+x/1!+x2/2!+x3/3!+x4/4! ...
    //e = 1 + x * x*2.0/2 + x*3.0/(2*3) + x*4.0/(2*3*4) ...
    for ( n = 1; n < 11; n++ ) {
        f *= n;  // factorial, don't exceed 12!
        e += x*n/f;
        printf( "%f  %d  %d\n", e, n, f);
    }

    getchar(); // wait
    return 0;
}
commented: Giving away answers is not being helpful -3

Used the code to test my reinstalled CodeBlock IDE. Works now.

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.