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

x=y=z=1 z=++x||++y&&++z Printf("%%%d";xyz) what is the values of x,y and z?????

3 Answers  


When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.

0 Answers   HCL,


how to TOGGLE Nth bit of variable in a MACRO

1 Answers   NDS,


what is the c.

3 Answers   IBM, TCS,


When do you say that a digraph is acyclic A)if and only if its first search does not have back arcs B)a digraph is acyclic if and only if its first search does not have back vertices C)if and only if its first search does not have same dfnumber D)None of these

1 Answers   Accenture, IBM,


How can you restore a redirected standard stream?

0 Answers  


Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?

0 Answers  


why little endian and big endian came?y they using differently? y they not used commonly ?wt is application of little and big ?

1 Answers  


int far *near * p; means

0 Answers   Honeywell,


What are the types of bitwise operator?

0 Answers  


The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference

0 Answers  


Explain what is dynamic data structure?

0 Answers  


Categories