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 print “hello world” without using semicolon?
Explain how can you tell whether two strings are the same?
How can I convert a number to a string?
Explain how does flowchart help in writing a program?
What does %d do in c?
How can I read data from data files with particular formats?
What is the acronym for ansi?
Why is c known as a mother language?
What are the types of data structures in c?
If i have an array 0 to 99 i.e,(Size 100) I place the values 1 to 100 randomly like a[0]=29,a[1]=56 upto array[99].. the values are only between 1 to 100. getting the array values by using scanf.. If i entered one wrong element value line a[56]=108. how can i find it.. and also how to find the missing value in 1 to 100.. and i want to replace the missing values.. any one of them know please post your answer..
What is the main difference between calloc () and malloc ()?
Explain pointers in c programming?
Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?
What is equivalent to ++i+++j?
Is array name a pointer?