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
Explain the difference between getch() and getche() in c?
How will you print TATA alone from TATA POWER using string copy and concate commands in C?
Is python a c language?
what is different between auto and local static? why should we use local static?
How is a macro different from a function?
What is the use of header files?
Is Exception handling possible in c language?
What are conditional operators in C?
1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.
In a header file whether functions are declared or defined?
Write a code to determine the total number of stops an elevator would take to serve N number of people.
What is static and volatile in c?
What is an lvalue?
in linking some of os executables are linking name some of them
Once I have used freopen, how can I get the original stdout (or stdin) back?