Created
October 19, 2013 20:20
-
-
Save kylelk/7061024 to your computer and use it in GitHub Desktop.
computes euler's constant to 32 places 2.71828182845904553488480814849027
This file contains hidden or 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 <stdio.h> | |
long factorial(int n) { | |
long result = 1; | |
for (int i = 1; i <= n; ++i) | |
result *= i; | |
return result; | |
} | |
int main () | |
{ | |
double n=0; | |
int i; | |
for (i=0; i<=32; i++) { | |
n=(1.0/factorial(i))+n; | |
} | |
printf("%.32f\n", n); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment