C Program to program to calculate e^x upto 10 terms given the value of x..



#include
#include
int main(void)
{
float x,t,s;
int n;
printf("enter the value of x in e^x\n");
scanf("%f",&x);
n=0;
t=1;
s=1;
do
{
n=n+1;
t=t*x/n;
s=s+t;
}
while (n<10);
printf("the value of e^x is %f",s);
getch();
return 0;
}




No comments:

Post a Comment