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 do I read the arrow keys? What about function keys?

614


2) Write a program that will help Air Traffic Control for an airport to view the sequence of flights ready for take-off. The airport can accommodate 10 flights waiting for take-off at any point in time. Each flight has a unique 3 digit numeric identifier.  Each time a flight takes-off, Air Traffic Control adds a flight to the waitlist. Each time a flight is added to the waitlist, the list of flights waiting to take-off must be displayed.  When a flight is cleared for take-off, Air Traffic Control removes the flight from the waitlist. Each time a flight takes-off, the list of flights waiting to take-off must be displayed.  Sequence of take-off is the sequence of addition to the waitlist

2519


How can I do graphics in c?

596


shorting algorithmS

1803


Write a Program to find whether the given number or string is palindrome.

613






Can we declare a function inside a function in c?

586


What do you mean by command line argument?

644


What is the 'named constructor idiom'?

640


What are qualifiers in c?

574


Why are all header files not declared in every c program?

601


What is optimization in c?

568


a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list

631


What do you mean by Recursion Function?

629


write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list

2236


What is a pointer and how it is initialized?

609