Hello ..i am trying to get the factorial of large integers but i get 0 every time i try,,can anyone tell me why ,,,Thanks in advance .
#include<stdio.h>
#include<conio.h>
int factorial(int n);
//main
main()
{
int x,fact;
printf("Enter a positive interger \n");
scanf("%d",&x);
fact=factorial(x);
if (fact==-1)
printf("the number is not positive !!");
else
printf("The factorial of %d is %d\n",x,fact);
getch();
}
//A function to compute the factorial
int factorial(int n)
{
if (n<0)
return -1;
if (n<2)
return 1;
else
return (n*factorial(n-1));
}