Advertisement
josiftepe

Untitled

Mar 24th, 2022
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. #include <iostream>
  2. #include <set>
  3. using namespace std;
  4. int main()
  5. {
  6. int n;
  7. cin >> n;
  8. double sum = 0.0;
  9. for(int i = 1; i <= n; i++) {
  10. sum += (double)(1.0) / (double)i;
  11. }
  12. cout << sum << endl;
  13. return 0;
  14. }
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement