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 what is the difference between functions abs() and fabs()?

0 Answers  


Create a registration form application by taking the details like username, address, phone number, email with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 3 users and display the details. While taking input password must appear as “****”.

0 Answers  


Write an algorithm for a program that receives an integer as input and outputs the product of of its digits. E.g. 1234 = 24, 705 = 0

4 Answers  


WAP to convert text into its ASCII Code and also write a function to decode the text given?

2 Answers  


what type of language is C?

13 Answers   Microsoft,






a simple program in c language

5 Answers   IBM,


what are the various memory handling mechanisms in C ?

4 Answers   HP,


what is a headerfile?and what will be a program without it explain nan example?

6 Answers   Assurgent,


What is assignment operator?

0 Answers  


we have to use realloc only after malloc or calloc ? or we can use initially with out depending on whether we are using malloc or calloc in our program ?

2 Answers  


what is level of tree if leaf node is at level 4.please explain.

1 Answers   Wipro,


Given an array of length N containing integers between 1 and N, determine if it contains any duplicates.

3 Answers   SilverKey,


Categories