Advertisement
x2311

Untitled

Dec 28th, 2021
1,103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. double fan(int n);
  4.  
  5. using namespace std;
  6. double b=-1;
  7. int a;
  8.  
  9. double y(int n)
  10. {
  11.     if (n==1) {
  12.         return 1./((a-2)+1./a);
  13.     }
  14.     b++;
  15.     return 1/((b * 2 + 1) + y(n - 2));
  16. }
  17.  
  18. int main()
  19. {
  20.     int n=3;
  21.     a=n;
  22.     double a =y(n);
  23.     cout << a;
  24.  
  25. }
  26.  
  27.  
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement