FACTORIAL OF A NUMBER

#include <stdio.h>
int fact(int);
void main()
{
int num,ans;
printf("Enter a number:\n");
scanf("%d",&num);
ans=fact(num);
printf("\n the facrorial of %d is %d ",num,ans);
}

int fact(int n)
{int i;
if(n!=0)
{
i=n*(fact(n-1));
return i;
}
if(n==0)
return 1;
}