Seal_of_approval

p38e11

Mar 1st, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. double f (int x, int n, int k)
  5. {
  6. if(k == n) return (double)(k + x);
  7. int i = k;
  8. return i + x/f(x,n, ++k);
  9. }
  10.  
  11. int main(void)
  12. {
  13. int x,n;
  14. cin >> x >> n;
  15. cout << f(x, n, 0);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment