SHARE
TWEET

Untitled

a guest Sep 13th, 2017 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
Top