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


Please Help Members By Posting Answers For Below Questions

How can I sort more data than will fit in memory?

632


Is flag a keyword in c?

684


What is substring in c?

645


What is meant by errors and debugging?

655


What does s c mean in text?

623






How would you rename a function in C?

625


#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); }

635


What is extern storage class in c?

519


What are the types of assignment statements?

635


A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

655


Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;

617


What is the use of sizeof () in c?

565


How will you declare an array of three function pointers where each function receives two ints and returns a float?

787


What is the process to generate random numbers in c programming language?

616


What is the difference between char array and char pointer?

531