Write a C program that computes the value ex by using the
formula
ex =1+x/1!+x2/2!+x3+3!+………….



Write a C program that computes the value ex by using the formula ex =1+x/1!+x2/2!+x3+3!+……�..

Answer / 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

More C Interview Questions

char ch="{'H','I',0};printf("%s",ch);what is output

9 Answers   Accenture,


Why main function is special give two reasons?

0 Answers  


whats the use of header file in c?

2 Answers  


Why dont c comments nest?

0 Answers  


What is #error and use of it?

0 Answers  


Method Overloading exist in c ?

3 Answers   Wipro,


What are the types of c language?

0 Answers  


Whether there can be main inside another main?If so how does it work?

14 Answers   Sail, Wipro,


What is the value of a[3] if integer a[] = {5,4,3,2,1}?

0 Answers  


When is the “void” keyword used in a function?

1 Answers  


Can you please explain the difference between strcpy() and memcpy() function?

0 Answers  


What is the function of multilevel pointer in c?

0 Answers  


Categories