this program not work
/* e(x) = 1 + x + x2 / 2! + x3 / 3! + x4/ 4! --------- xn / n! */
#include
#include
#include
void main()
{
int fact();
float x, t, sum;
int i, n;
printf("\n Enter the Value of x & n:");
scanf("%f %d", &x, &n);
x = x * 3.14/180;
t = 1;
sum = 1;
for ( i = 1; i <= n; i++)
{
t = t * pow(x, i) / fact(i);
sum = sum + t;
}
printf("\n The Value of ex = %f \n", sum);
}
int fact( int n)
{
int i;
for ( i = 1; i <= n; i++)
fact *= i; // this line error is found pls correct it
return fact;
}
2007-06-28
20:21:34
·
3 answers
·
asked by
robin j
1
in
Computers & Internet
➔ Programming & Design