Write a C program that computes the value ex by using the
formula
ex =1+x/1!+x2/2!+x3+3!+………….
Answer Posted / dally
#include<stdio.h>
int main()
{
char c = 'X';
int i,n,sum = 0;
printf("Enter values for n\n");
scanf("%d\n",&n);
for(i=0;i<n;i++)
{
sum = sum+power(c,i)/fact(i);
}
fact(int i)
{
int p=1 ,fact;
if(p<=i)
{
fact = p*fact(p++);
}
return fact;
}
| Is This Answer Correct ? | 24 Yes | 43 No |
Post New Answer View All Answers
If null and 0 are equivalent as null pointer constants, which should I use?
What is volatile variable how do you declare it?
Explain how to reverse singly link list.
How would you obtain the current time and difference between two times?
What are the advantages of c language?
What is difference between structure and union with example?
When is a void pointer used?
What is c preprocessor mean?
How do I create a directory? How do I remove a directory (and its contents)?
The statement, int(*x[]) () what does in indicate?
Explain how can I make sure that my program is the only one accessing a file?
How is pointer initialized in c?
What are header files and explain what are its uses in c programming?
how can use subset in c program and give more example
Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc