#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{ clrscr();
int n,x,i,j;
float p,fact=1.0,sum=0.0;
cout<<"\n\tEnter the number: ";
cin>>n;
cout<<"\n\n\tEnter the Value of \'x\': ";
cin>>x;
for(i=1;i<=n;i++)
{ for(j=(2*j-1);j>0;j--)
{ fact=j*fact;
if(i%20==0)
p=(-1)*pow(x,(2*i-1));
else
p=pow(x,(2*i-1));
sum+=p/fact;
}
}
cout<<"\n\tThe sum is "<<sum;
getch();
}
Captain Neo 0 Newbie Poster
Clinton Portis 211 Practically a Posting Shark
richieking 44 Master Poster
PrimePackster 10 Runaway Poster
PrimePackster 10 Runaway Poster
VernonDozier commented: Pos. rep to to get you back in the game. +15
richieking 44 Master Poster
PrimePackster 10 Runaway Poster
PrimePackster 10 Runaway Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.