#include <stdio.h>
long  Fact(int  n);
int main(void)
{
    int  n;
    long result;
    printf("Input n:");
    scanf("%d", &n);
    result = Fact(n);            /* 调用递归函数Fact()计算n! */
    if(result == -1)              /* 处理非法数据 */
        printf("n<0, data error!\n");
    else                            /* 输出n!值 */
        printf("%d! = %ld\n", n, result);
    return 0;
}
long  Fact(int  n)
{
   long f;
   if(n<0) f=-1;
   else if(n==1||n==0) f=1;
   else f=n*Fact(n-1);
   return f; 
}