求1!+2!+3!+.+n!怎么错了#include int h (int n) {using namespace std; int sum=0,s=1,t;

来源:学生作业学帮网 编辑:学帮网 时间:2024/06/06 04:44:25

求1!+2!+3!+.+n!怎么错了#include int h (int n) {using namespace std; int sum=0,s=1,t;

要写这个程序吗?
Void main()
{
int sum=0;
for(i=1;i

1楼算法很对, 但我个人觉得 当N大于9的时候 int 类型越界!
如果越界 这个算法不能用了,只能用 字符串来处理! 麻烦的很!