C Programs / Series Sum C Program

sum=1 - x2 / 2! + x4 / 4! - x6 / 6! + x8 / 8! - x10 / 10! */

Program
#include
#include
void main()
{
int i,j;
float x,y,z,temp=1,sum=1;

printf("Enter X value:");
scanf("%f",&x);
for(i=1;i<=5;i++)
{
y=pow(-1,i)*pow(x,2*i);
for(j=1;j<=2*i;j++)
{
temp=temp*j;
z=y/temp;
}
sum=sum+z;
}
printf(" Series sum= %f",sum);
}
Input Enter X value: 5
Output Series sum= 1.069001


Home     Back