Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int i = 1;
  7. int n;
  8. cin >> n;
  9. double sum = 0;
  10. int c = 1;
  11. while ( i <= n) {
  12. c = c*i;
  13. sum = sum + 1.0*1/c;
  14. i++;
  15. }
  16. cout << sum;
  17. return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement