> 其他 >
c语言 自定义函数,1到10的阶乘,怎么写啊
人气:251 ℃ 时间:2020-01-26 09:17:13
解答
#include "stdio.h"
int jiecheng(int n)
{
if(n==1)
return 1;
else return n*jiecheng(n-1);
}
int main()
{
printf("10的阶乘为 %d ",jiecheng(10));
return 0;
}
推荐
猜你喜欢
© 2025 79432.Com All Rights Reserved.
电脑版|手机版