Haval1

Fact

Jan 20th, 2019
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include"stdafx.h"
  2. #include "string"
  3. #include <iostream>
  4. using namespace std;
  5. int main()
  6. {
  7.     int i;
  8.     float f = 1, n, e = 1;
  9.     cout << "Enter N : ";
  10.     cin >> n;
  11.     for (i = 1;i <= n;i++) {
  12.         f = f*i;
  13.         e += 1 / f;
  14.     }
  15.     cout << "E : " << e << endl;
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment