Program to find the value of e raised to power x using while
loop
Answer Posted / s.d.bahinipati
#include<stdio.h>
#include<math.h>
main()
{
int i,j,n,x,fact=1;
float c,t,sum=1;
printf("enter the value of x and n);
scanf("%d%d",&x,&n);
while(i<n-1)
{
c=pow(x,i);
for(j=1;j<i;j++)
fact=fact*j;
t=c/fact;
sum=sum+t;
}i=i+1;
printf("the sum of series is %f",sum);
getch();
}
Is This Answer Correct ? | 34 Yes | 28 No |
Post New Answer View All Answers
How can I sort more data than will fit in memory?
Is flag a keyword in c?
What is substring in c?
What is meant by errors and debugging?
What does s c mean in text?
How would you rename a function in C?
#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }
What is extern storage class in c?
What are the types of assignment statements?
A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
What is the use of sizeof () in c?
How will you declare an array of three function pointers where each function receives two ints and returns a float?
What is the process to generate random numbers in c programming language?
What is the difference between char array and char pointer?