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
Can 'this' pointer by used in the constructor?
What is pragma in c?
GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA
void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }
What is the use of header?
How can I make it pause before closing the program output window?
Define the scope of static variables.
What is non linear data structure in c?
How will you declare an array of three function pointers where each function receives two ints and returns a float?
Can true be a variable name in c?
Synonymous with pointer array a) character array b) ragged array c) multiple array d) none
What is a dynamic array in c?
What is meant by type specifiers?
Explain what are multibyte characters?
I heard that you have to include stdio.h before calling printf. Why?