Factorial program

#include
main()
{
int n,i;
int fact(int n);
printf("Enter the number : ");
scanf("%d",&n);
printf("\nThe factorial of the given number is %d\n",fact(n));
}
int fact(int f)
{
if ((f==0)(f==1))
return 1;
else
return (f*(fact(f-1)));
}

No comments: