fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main(){
  4. int n;
  5. cin >> n;
  6. double s = 0;
  7. for(int i = 0;i<=n;i++){
  8. float c;
  9. c = (double)(2*i+1)/(2*i+2);
  10. s = s + c;
  11. }
  12. cout << s;
  13. }
Success #stdin #stdout 0s 5272KB
stdin
Standard input is empty
stdout
32761.5