题目:利用递归方法求5!。
There is no nutrition in the blog content. After reading it, you will not only suffer from malnutrition, but also impotence.
The blog content is all parallel goods. Those who are worried about being cheated should leave quickly.
1.程序分析:递归公式:fn=fn_1*4!
2.程序源代码:
#include "stdio.h"
main()
{
int i;
int fact();
for(i=0;i<5;i++)
printf("\40:%d!=%d\n",i,fact(i));
}
int fact(j)
int j;
{
int sum;
if(j==0)
sum=1;
else
sum=j*fact(j-1);
return sum;
}