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
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.
Are there any problems with performing mathematical operations on different variable types?
Explain what is the difference between the expression '++a' and 'a++'?
What does c mean in basketball?
What is difference between stdio h and conio h?
What would happen to X in this expression: X += 15; (assuming the value of X is 5)
What is string function in c?
What is difference between function overloading and operator overloading?
What are global variables and how do you declare them?
What is #define in c?
Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.
What does the format %10.2 mean when included in a printf statement?
Why we not create function inside function.
Explain the difference between ++u and u++?
How can you check to see whether a symbol is defined?