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 |
Explain about the functions strcat() and strcmp()?
What is spaghetti programming?
Why doesn't the code "a[i] = i++;" work?
#include<stdio.h> int main(){ int a[]={1,2,3,5,1}; int *ptr=a+4; int y=ptr-a; printf("%d",y); }
When is a “switch” statement preferable over an “if” statement?
What is difference between array and pointer in c?
what is the size of an integer variable?
What are header files in c?
write a program to display & create a rational number
What does & mean in scanf?
Why do we use null pointer?
. Consider the following program main() { int a[5]={1,3,6,7,0}; int *b; b=&a[2]; } The value of b[-1] is (A) 1 (B) 3 (C) -6 (D) none