Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- double foo(int step) {
- double result = step;
- for (; step > 0; step--) {
- result = (step - 1) + 1./result;
- }
- return result;
- }
- int main()
- {
- int n = 3;
- double res;
- res = foo(n);
- std::cout<<res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement