Sum of e series

Submitted by Karthikeyan on Sep 06, 2009 - 07:01

C Program to find Sum of Exponential series for the given value of x and n

    int f, i, j, n;
    double x, xt, ex = 0.0;
    printf("\n\t\t Sum of Exponential series");
    printf("\nEnter the value of x and n");
    scanf("%lf ",&x);
    scanf("%d", &n);
    for(i=0; i<=n; i++)
        for(f=1, j=1; j<=i; j++)
        f = f*j;
        xt = pow(x, i) / (double)f;
        ex = ex + xt;

    printf("\n The Exponential value = %lf", ex);
    printf("\n The use of library function Exp. value = %lf", exp(x));