阶乘和算法的改进之阶乘和
#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;
}