[求助]n!的递归,但无论N为何值,程序总显示同一个结果
int n,t;
int f(n)
{
if(n<=1) t=1;
else
t=f(n-1)*n
return 0;
}
void main()
{
cin>>n;
cout>>'N!='>>t>.endl;
}
但是不论N是何值程序总是输出一个很大的数,请问这是为什么啊?
int n,t;
int f(n)
{
if(n<=1) t=1;
else
t=f(n-1)*n
return 0;
}
void main()
{
cin>>n;
cout>>'N!='>>t>.endl;
}
但是不论N是何值程序总是输出一个很大的数,请问这是为什么啊?