#include <stdio.h>
int main()
{
double x;
int n;
scanf("%lf", &x);
printf("Enter the value of x:%lf \n",x);
scanf("%d", &n);
printf("Enter the number of terms (n):%d \n",n);
double result = 1.0;
double term = 1.0;
for (int i = 1; i <= n; i++)
{
term = x / i; //term=term(x/i)
result += term;
}
printf("e^%.2lf is approximately %.6lf\n", x, result);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: