有没有会编程序的大仙编写一个程序,计算1!+2!+3!+…+10!的值

2025-04-05 02:15:43
推荐回答(1个)
回答1:

用递归很方便;我简单的把函数给你写一下,主函数再用循环调用就行。
unsigned static int math(unsigned int n)
{ unsigned int s;
if(n<=1)

s=1;
else

s=n*math(n-1);
return s;

}