Name: Anonymous 2009-11-28 17:54
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double factorial(double l)
{
double fact = 1;
while (l>1)
{
fact=fact*l;
l=l-1;
}
return fact;
}
int main()
{
double f2,e,f,l,n;
n=exp(5);
e=0;
printf("exp(5)=%4.5f\n\n",n);
for(l=1;l<7;l++)
{
f=factorial(l);
f2=pow(f,l);
e=e+(f2/f);
}
e=e++;
printf("e^(n+1)!=%.f\n\n",e);
system("pause");
return 0;
}
I should see this - 1.934917
I see this - 193491763...
#include <stdlib.h>
#include <math.h>
double factorial(double l)
{
double fact = 1;
while (l>1)
{
fact=fact*l;
l=l-1;
}
return fact;
}
int main()
{
double f2,e,f,l,n;
n=exp(5);
e=0;
printf("exp(5)=%4.5f\n\n",n);
for(l=1;l<7;l++)
{
f=factorial(l);
f2=pow(f,l);
e=e+(f2/f);
}
e=e++;
printf("e^(n+1)!=%.f\n\n",e);
system("pause");
return 0;
}
I should see this - 1.934917
I see this - 193491763...