Created
June 28, 2015 07:13
-
-
Save RezaBidar/d2e5b9e9fddb4b929c77 to your computer and use it in GitHub Desktop.
for davood mirzaii
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std ; | |
int fact(int x){ | |
if(x == 0) return 1 ; | |
return x * fact(x-1); | |
} | |
int main(){ | |
int n ; | |
float e = 0 ; | |
cin >> n ; | |
for(int i = 0 ; i <= n ; i++){ | |
e += 1.0 / (float)fact(i) ; | |
} | |
cout << e ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment