Advertisement
Alx09

Bianca problema2

Jan 13th, 2022
1,159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.26 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. double suma(int n){
  5.   if (n < 1 )
  6.      return 0;
  7.   return  1.0/(2 * n + 1) + suma(n - 1);
  8. }
  9. int main()
  10. {
  11.     int n;
  12.     cout << "n= "; cin >> n;
  13.     cout<<"Rezultatul sumei este: " << suma(n);
  14.     return 0;
  15. }
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement