Advertisement
VictoriaLodochkina

lab 11 z1 EVGENY

Feb 8th, 2020
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. float calc(int y);
  7.  
  8. int i = -1;
  9.  
  10. int main()
  11. {
  12.     float x;
  13.     int n;
  14.     cout << "Enter n: " << endl;
  15.     cin >> n;
  16.     x = calc(2*n+1);
  17.     cout << "Your result: " << x << endl;
  18.     return 0;
  19. }
  20.  
  21. float calc(int y)
  22. {
  23.    
  24.     i += 2;
  25.     float rez = 0;
  26.     if (i < y)
  27.         rez = i + (1.0 / calc(y));
  28.     else
  29.         rez = i;
  30.     return rez;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement