Advertisement
SergeyPGUTI

4.2.16

Oct 1st, 2015
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int n,i=1;
  9.     double sum=1,Znamenetion=i;
  10.     cin>>n;
  11.  
  12.     while(i<=n)
  13.     {
  14.         Znamenetion*=i;
  15.         sum+=1/Znamenetion;
  16.         i++;
  17.     }
  18.     cout<<sum;
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement