1的阶乘加到100的阶乘

#include <iostream>
using namespace std;
int main() 
{
	int i;
	double t=0,s=1;
	for(i=1;i<100;i++)
	{
		s=s*i;
		t=s+t;
	}
	cout<<t;
	return 0;
}

  第二种
#include <iostream>
using namespace std;
int main() 
{
	int i,j;double t=0,s;
	for(i=1;i<100;i++)
	  s=1;
	for(j=1;j<=i;j++)
		s=s*j;
		t=s+t;
	cout<<t;
	return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_43822669/article/details/90552710
今日推荐