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 difference between class and structure?

0 Answers  


When should a type cast not be used?

0 Answers  


What is the output for the program given below typedef enum grade{GOOD,BAD,WORST,}BAD; main() { BAD g1; g1=1; printf("%d",g1); }

4 Answers   ADITI,


Can a program have two main functions?

0 Answers  


#define FALSE -1 #define TRUE 1 #define NULL 0 main() { if(NULL) puts("NULL"); else if(FALSE) puts("TRUE"); else puts("FALSE"); }

1 Answers  






Where static variables are stored in c?

0 Answers  


Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.

0 Answers   Expedia,


1. Write a c pgm to print 1 to 100 without using loops. 2. Write a c pgm for leap year 3. Write a c pgm fibbonacci series,factorial 4. Write a c pgm count no of lines , blanks, tabs in a para(File concept) 5. Write a c pgm to print the letter as per given condition i.e.. if u give 4 out put should b 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 6.how do get the o/p in number from 1 to 100 in the screen without using control statement? 7. who do u print the word "hello world" without using "printf" statement? 8. write sql program to get the detail of student in a class? Definitions: structure union arrays linkedlist macros directives difference b/w pre processorsDiffrence: 1.Constructors and destructors 2.Structure and Union 3.Array and Lists 4.pre processor... 5. Privillages in C++ 6.structure and union 7.break and continue 8.while and dowhile Pgm..

3 Answers  


What are volatile variables?

1 Answers   Mind Tree,


How would you obtain the current time and difference between two times?

0 Answers   TISL,


Ca some one please help me with aC code to allow user enter numbers from 1 to 20 without repeating and prnt the sum of those numbers thnx

4 Answers  


How can I invoke another program from within a C program?

8 Answers  


Categories