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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is extern used in c?

614


What are the 5 types of organizational structures?

554


What are the rules for the identifier?

676


What is s in c?

621


What does 4d mean in c?

951






Why is struct padding needed?

635


Can the sizeof operator be used to tell the size of an array passed to a function?

622


#include int main(){ int i=10; int *ptr=&i; *ptr=(int *)20; printf("%d",i); return 0; } Output: 20 can anyone explain how came the output is 20

1269


Why c is called free form language?

575


Explain what is meant by 'bit masking'?

646


Explain what is a pragma?

596


Why do we use int main?

615


What is void main () in c?

738


Is null valid for pointers to functions?

616


What does c mean?

591