write a program that eliminates the value of mathematical
constant e by using the formula
e=1+1/1!+1/2!+1/3!+



write a program that eliminates the value of mathematical constant e by using the formula e=1+1/1!..

Answer / devang

/* Fact = factorial, n = no. of terms */
main()
{
int fact=1,i,n;
float e=0;
printf(" Enter the no. of terms");
scanf("%d",&n);

for(i=1;i<=n,i++)
{
fact=fact*i;
e = e + (1/fact);
}
printf("he value is = %f", e);
return 0;
}

Is This Answer Correct ?    5 Yes 0 No

Post New Answer

More C Interview Questions

Explain the meaning of keyword 'extern' in a function declaration.

0 Answers  


How do you generate random numbers in C?

0 Answers  


how logic is used

0 Answers  


What is strcpy() function?

0 Answers  


Function shall sum members of given one-dimensional array. However, it should sum only members whose number of ones in the binary representation is higher than defined threshold (e.g. if the threshold is 4, number 255 will be counted and 15 will not) - The array length is arbitrary - output the results to the stdout

0 Answers   XYZ,






a=(1,2,3); b=1,2,3; c=1,(2,3); d=(1,2),3; what's the value of 'a','b','c','d'

2 Answers  


What's the right way to use errno?

0 Answers  


Tell me when would you use a pointer to a function?

0 Answers  


Suppose I want to write a function that takes a generic pointer as an argument and I want to simulate passing it by reference. Can I give the formal parameter type void **, and do something like this? void f(void **); double *dp; f((void **)&dp);

1 Answers  


What is strcmp in c?

0 Answers  


difference between string and array?

6 Answers  


Is c still used?

0 Answers  


Categories