+ 1
To find the sum of series using functions 1+x+x^2/2!+x^3/3!.......x^n/n! ?
Plz ans this ques https://www.sololearn.com/discuss/1316935/?ref=app
5 Réponses
+ 3
Where is your attempt?
+ 1
Use Python Platform and write this Function 1+x+x^2/2!+x^3/3!.......x^n/n!? in a python code and then run this code to get exact answer of this function.
0
This is a mathematical series program where a user must enter the number of terms up to which the sum of the series is to be found. Following this, we also need the value of x, which forms the base of the series.
0
// C program to find sum of series
// 1 + x/1 + x^2/2 + x^3/3 + ....+ x^n/n
#include <math.h>
#include <stdio.h>
double sum(int x, int n)
{
double i, total = 1.0;
for (i = 1; i <= n; i++)
total = total +
(pow(x, i) / i);
return total;
}
// Driver code
int main()
{
int x = 2;
int n = 5;
printf("%.2f", sum(x, n));
return 0;
}
0
and at last output of your code is 18.07