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

What is hash table in c?

0 Answers  


#include<stdio.h> int fun(); int i; int main() { while(i) { fun(); main(); } printf("hello \n"); return 0; } int fun() { printf("hi"); } answer is hello.how??wat is tat while(i) mean?

7 Answers   Intel,


What is sizeof array?

0 Answers  


What is c basic?

0 Answers  


Explain what are preprocessor directives?

0 Answers  






1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures

0 Answers   KPIT,


What does calloc stand for?

0 Answers  


in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none

0 Answers  


What is the difference between char a[] = "string"; and char *p = "string"; ?

14 Answers   Adobe, Honeywell, TCS,


What is meant by preprocessor in c?

0 Answers  


What is c language and why we use it?

0 Answers  


What is multidimensional arrays

0 Answers  


Categories