Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int i = 1;
- int n;
- cin >> n;
- double sum = 0;
- int c = 1;
- while ( i <= n) {
- c = c*i;
- sum = sum + 1.0*1/c;
- i++;
- }
- cout << sum;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement