+ 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

23rd Nov 2018, 4:02 AM
Shreya
5 Réponses
+ 3
Where is your attempt?
23rd Nov 2018, 4:05 AM
Diego
Diego - avatar
+ 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.
23rd Nov 2018, 4:09 AM
Ravi Prakash Kumawat
Ravi Prakash Kumawat - avatar
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.
23rd Nov 2018, 4:11 AM
Ravi Prakash Kumawat
Ravi Prakash Kumawat - avatar
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; }
23rd Nov 2018, 4:12 AM
Ravi Prakash Kumawat
Ravi Prakash Kumawat - avatar
0
and at last output of your code is 18.07
23rd Nov 2018, 4:13 AM
Ravi Prakash Kumawat
Ravi Prakash Kumawat - avatar