Hey I really need some help

Gotta submit my assignment in 4 hours. Please help


Question:

Write a method with header double series(int i)
Formula for series is given below:
f(i) = 1/3 + 2^2/4 + 3^2/5 + . . . + i^2/i+2
Use the program to render the flowing table using above method.
Example run:
Enter value of 1: 20.
1 0.3333
2 1
...... ....
19 17.1904
20 18.1818
Three hours and counting down, then.

Please DON'T double-post: http://www.cplusplus.com/forum/beginner/265856/#msg1144611

Please DO show some attempt to write some code yourself.

1
2
3
4
5
6
7
8
9
10
def series( i ):
   sum = 0
   for n in range ( 1, i + 1 ):
      term = n * n / ( n + 2 )
      print( "{:2d}  {:7.4f}".format( n, term ) )
      sum += term
   return sum

s = series( 20 )
print( "Sum of series = ", s )


 1   0.3333
 2   1.0000
 3   1.8000
 4   2.6667
 5   3.5714
 6   4.5000
 7   5.4444
 8   6.4000
 9   7.3636
10   8.3333
11   9.3077
12  10.2857
13  11.2667
14  12.2500
15  13.2353
16  14.2222
17  15.2105
18  16.2000
19  17.1905
20  18.1818
Sum of series =  178.7632530008691
Last edited on
Thankyou. And sorry for double posting.
Topic archived. No new replies allowed.