To Calculate The sum : 1- x^2/2! +x^3/3!-.....
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
float sum; int x;
printf ("Please input x : ");
scanf ("%d", &x);
sum = 1- pow(x,2)/1*2 + pow(x,4)/6*4 - pow(x,6)/24*30 + pow (x,8)/24*30*56 - pow (x,10)/24*30*56*90;
printf ("\nsum is %f",sum);
getch();
}
No comments:
Post a Comment