#include<stdio.h>
long fact(int x);
int main()
{ long x=fact(5);
printf("%ld",x);
}
long fact(long x)
{
long prod=1;
int i=1;
if(x==0)
return 1;
else
{
while(i<=x)
{
prod=prod*i;
i++;
}
return prod;
}
}
Here's the code I am using to find out the value of e (to the power x,here x=1)

Now I get the following ERROR:
error: conflicting types for 'fact' I am using long return type all the time
EDIT: I changed the definition signature and it worked:
#include<stdio.h>
long fact(int x)
{
long prod=1;
int i=1;
if(x==0)
return 1;
else
{
while(i<=x)
{
prod=prod*i;
i++;
}
return prod;
}
}
int main()
{ long x=fact(7);
printf("%ld",x);
}