题目描述: 用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; }
运行结果: