Wrong Answer
/in/foo.c:10:2: warning: return type defaults to 'int' [-Wimplicit-int] main() ^~~~ /in/foo.c: In function 'ff': /in/foo.c:8:9: warning: 'f' may be used uninitialized in this function [-Wmaybe-uninitialized] return (f); ^
代码
#include<stdio.h>
long ff(int n)
{
long f;
if(n<0) printf("n<0,input error");
else if(n==0||n==1) f=1;
else f=ff(n-1)*n;
return (f);
}
main()
{
int n;
long y;
printf("请输入一个整数:\n");
scanf("%d",&n);
y=ff(n);
printf("%d!=%ld",n,y);
}