this program calculates the approximate value of e to the x(e^x)
and subtracts that value from the exact value. im not soo sure if its working correctly, well it runs but im not sure im getting the correct out put, its for a school hw assignment. also what is the place holder symbol for double, i have to do this program for double and for float.


#include <stdio.h>
#include <math.h>

float factorial(float);//factorial function header
float myE(float,float);

main()
{
float exponent_e,non_pierc,error_amt;
float x=2.0;
float n = 0;


non_pierc=0.0;
exponent_e=exp(x);

//printf("X= %f\n",x);

for(n=10;n<=35;n++)
{

non_pierc=myE(x,n);

error_amt=(exponent_e-non_pierc);
printf("%.0f | %.12f \n",n,error_amt);

}

return 0;
}
/////////////////////////////
float myE (float x, float n)
{
if (n<1.0) return 1.0;
else
return ((pow(x,n)/factorial(n)) + myE(x,n - 1.0));
}

float factorial(float a)
{
if(a <=1)
return 1;
else
return a * factorial(a -1);
}