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


Please Help Members By Posting Answers For Below Questions

What is spaghetti programming?

884


Do you have any idea about the use of "auto" keyword?

880


Can we change the value of static variable in c?

771


What is the use of static variable in c?

831


What are linked lists in c?

871


Explain what is dynamic data structure?

899


Which is better between malloc and calloc?

911


What is calloc() function?

870


What is maximum size of array in c?

785


Why doesnt this code work?

833


void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

1503


How will you find a duplicate number in a array without negating the nos ?

1864


Can we declare variables anywhere in c?

778


Give the rules for variable declaration?

934


What is typedef example?

856