#include<stdio.h>
#include<math.h>
int factorial( int );
int main()

    int n;
    double x,i;
    double value, sinx;
    value = sinx = 0.0;

    printf("Enter the value for x and i");
    scanf("%lf %d", &x, &n);
    for( i=1; i<=n; i=i+2)
    {
        value = pow(x,i);
        sinx += (x - value / factorial(i));
    }

    printf("Result - %f", sinx );

    getchar();
    return 0;
}
int factorial( int n )
{
   int j, fact=1;
   for( j=n; j>0; j-- )
     fact = fact * j;

   return fact;
}


#include<stdio.h>
#include<math.h>
int factorial( int );
int main()

    int n;
    double x,i;
    double value, sinx;
    value = sinx = 0.0;

    printf("Enter the value for x and i");
    scanf("%lf %d", &x, &n);
    for( i=1; i<=n; i=i+2)
    {
        value = pow(x,i);
        sinx += (x - value / factorial(i));
    }

    printf("Result - %f", sinx );

    getchar();
    return 0;
}
int factorial( int n )
{
   int j, fact=1;
   for( j=n; j>0; j-- )
     fact = fact * j;

   return fact;
}


#include<stdio.h>
#include<math.h>
int factorial( int );
int main()

    int n;
    double x,i;
    double value, sinx;
    value = sinx = 0.0;

    printf("Enter the value for x and i");
    scanf("%lf %d", &x, &n);
    for( i=1; i<=n; i=i+2)
    {
        value = pow(x,i);
        sinx += (x - value / factorial(i));
    }

    printf("Result - %f", sinx );

    getchar();
    return 0;
}
int factorial( int n )
{
   int j, fact=1;
   for( j=n; j>0; j-- )
     fact = fact * j;

   return fact;
}
This article has been dead for over six months. Start a new discussion instead.