Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- float calc(int y);
- int i = -1;
- int main()
- {
- float x;
- int n;
- cout << "Enter n: " << endl;
- cin >> n;
- x = calc(2*n+1);
- cout << "Your result: " << x << endl;
- return 0;
- }
- float calc(int y)
- {
- i += 2;
- float rez = 0;
- if (i < y)
- rez = i + (1.0 / calc(y));
- else
- rez = i;
- return rez;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement