阶乘和算法的改进之阶乘和
#include<iostream>
using namespace std;
int Factorials(int n)
{
if (n == 0)
return 1;
else
return n*Factorials(n-1);
}
int Factorialssum(int b)
{
int a;
for(int i = b;i >= 1;i--)
a+=Factorials(i);
return a;
}
int main(void)
{
cout<<Factorialssum(3)<<endl;
}
相关推荐
SciRui 2020-01-31
风和日丽 2020-01-02
tvk 2019-12-28
seekerhit 2019-12-05
xw0 2019-09-06
85274852 2012-04-29
ivabrother 2018-05-07
一两银子 2017-04-03
amazingbo 2019-04-29
83427718 2009-07-15
yueloveme 2013-05-30
samsai00 2008-05-16
81540398 2010-06-22
wujimiao 2019-01-21
AStudystudy 2007-11-24
fundebug 2019-03-29
BAT 批处理程序 2017-06-20