题目描述:
用while语句求1!+2!+3!+...+10!

#include<iostream>
#include<cstdio>

using namespace std;
int main(void){
	int a=1,i=1,sum=0;
	while(i<=10){
		a=a*i;
		sum+=a;
		i++;
	}
	cout<<"结果为:"<<sum<<endl;
}

运行结果:
用while实现阶乘

相关文章:

  • 2022-12-23
  • 2021-11-22
  • 2021-04-01
  • 2021-11-17
  • 2021-11-17
  • 2021-09-20
  • 2021-09-20
  • 2021-11-18
猜你喜欢
  • 2021-12-14
  • 2021-12-04
  • 2022-01-17
  • 2021-09-20
  • 2021-09-20
相关资源
相似解决方案