hi all i have the following code:
Code:
int x, factorial;
double value, inverse_factorial;
printf("Enter the smallest value of 1/n!: ");
scanf(" %lf", &value);
printf("value = %lf\n", value);
x = 2;
factorial = 1; //set to 1!
inverse_factorial = 1;
while (inverse_factorial > value)
{
factorial *= x; // 1!*2=2! 2!*3=3!......8!*9=9!
x++; //incriment multiplier
inverse_factorial = 1/factorial;
}
printf("x = %d\n", x);
return 0;
the only value of x i ever get is 3 no matter how small i set value and i cant for the life of me see why
any suggestions greatly appreciated
coop