SUM OF SERIES 1-x/1! + x3/2!…

.

#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int f=1,h,j,k=1,i,n,x;
float s=0;
cout<<“Enter the numerator and limit”<<endl;
cin>>x>>n;
for(i=1;i<((2*n)-1);i=i+2)
{
f=1;
for(j=1;j<=(i+1)/2;j++)
{
f=f*j;
}
s=(s+((pow(x,i) * pow(-1,k))/f));
k++;
}
cout<<“Result “<<s+1;
getch();
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s