#include <iostream> // stems from the fact that e = 1/1! + 1/2! + 1/3! +... etc long factorial(long number){ long answer = 1; for(int i = 1; i <= number; i++){ answer *= i; } return answer; } int main(int argc, char *argv[]){ double e = 0.0; for(int iterations = 0; iterations < 20; iterations++){ e = e + (1.0/(float)factorial(iterations)); } printf("%.10f\n", e); return 0; }