#include <stdio.h>
#include <math.h>
int main()
float i, x;
double fact=0, sum=0;
printf("Enter value of x as the power of e: ");
scanf("%f", &x);
printf("Enter n as the number of terms: ");
scanf("%d",&i);
for (i = 0; i < 99999; i++)
{
sum = 1 + x;
fact = fact * i;
sum = sum + pow(x, i)/(fact);
}
if (sum == sum)
printf("The value of e^%f is %lf",x,sum);
return 0;
Kepler123 0 Newbie Poster
Reverend Jim 4,968 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
xrjf 213 Posting Whiz
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.