I was given a question in my programming class to create a program to find the factorial of any number greater than zero and to use Gosper's formula to approximate it. I'm not sure what I am doing wrong so any help would be appreciated!
Code:
#include <stdio.h>
#include <math.h>
#define PI 3.14159265
double equation(int n);
int
main(void)
{
int input, double answer;
printf("Please input a number>");
scanf("%d", &input);
answer = equation(input);
printf("%d equals approximately %.2f\n", input answer);
return (0);
}
double equation(n)
{
double nfaca, nfacb, nfacc, nfacd;
nfaca = pow(n,n) * pow(e,-n);
nfacb = ((2 * n) + .33);
nfacc = sqrt(nfacb * PI);
nfacd = nfaca * nfacc;
return (answer);
}