Example: In the following given program, the function of the function fun is: find n! (n<20), and the value of the factorial sought is returned as the function value. For example, if n=5, 120 should be output.
请修改程序中的错误,得出正确的结果。
注意:不要改动main函数,不能增行或删行,也不能更改程序的结构。
代码如下:
#include<conio.h>
#include<stdio.h>
long fun(int n)
{
if(n>1)
return(n*fun(n-1));
return 1;
}
main()
{
int n=5;
printf("%d!=%ld\n",n,fun(n));
}
The output running window is as follows:
越努力越幸运!
加油,奥力给!!!