WAP to find the sum of the series S=1/1!+2/2!+3/3!+4/4!+.......+n/n!
Answers
Answered by
1
Answer:
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
float i,x,sum=1,p=1;
int n;
cout<<" \n 1+x^1/1! + x^2/2! + ... +x^n/n! ";
cout<<" \n Enter the value of x : ";
cin>>x;
cout<<" \n Enter the value of n : ";
cin>>n;
for(i=1;i<=n;i++)
{
p=p*x/i;
sum=sum+p;
}
cout<<"\n Sum="<<sum;
getch();
}
Explanation:
C++ code
Similar questions