C++
Restrictions ● There should be no loops such as for loops, while loops, do-while loops, foreach loops used in this work. Instead use recursion only. Write a recursive function named F that takes a single parameter of type int (named n) to compute the following series. 1 1 1 + 1 f(n) = - - + + 3 8 15 n(n + 2) Test your function by writing a main function and calling F with various values for n. Output should be rounded to 4 decimal places. Here are some sample test cases. F(1) returns 0.3333 F(2) returns 0.4583 F(3) returns 0.525 F(4) returns 0.5667 +
C++
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am