Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- double kocham_piwo(double n)
- {
- if(n==1) return 0.5;
- else return (n/(n+1))+ kocham_piwo(n-1);
- }
- int main()
- {
- double a;
- cin>>a;
- cout.precision(5);
- cout<<fixed<<kocham_piwo(a);
- pawel
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement