i'm still new at this, so i really need your help.
basically i try to find the value of this equation :
i already find the formula to find final the value of factorial :Code:e = 1 + 1/1! + 1/2! + 1/3! +.......
but i wasn't able to get the code to work. this is how i did so far :Code:while ( value1 > 0) { var1 = var2 * value1--; result = result * var1; }
where did i messed up ? what should i change ? I already tried diffrent version, and this one is the closest i get... At lease that is what i think....Code:#include <stdio.h> #include <math.h> #include <stdlib.h> main () { int a, b = 0, c = 1, d = 0, e = 0, f = 1, D = 0; while ( a > 0 ) { /* loop for the whole formula do { /* loop for the factorial */ D = d; b = c * d--; f = f * b; } while ( d > 0 ); a = 1 / f; e = e + a; D++; } printf ( "%d", e ); return 0; }



LinkBack URL
About LinkBacks


