c语言编程题,计算1+2!+3!+4!+······+100!的值

2024-11-27 05:28:42
推荐回答(4个)
回答1:

#include "stdafx.h"
#include

double Fun( int n)
{
double sum = 0;
for(int i =1; i< n+1 ;i++)
{
sum = sum +( double )1/i;
}
return sum;
}
int main(int argc, char* argv[])
{
cout< cin;
return 0;
}

回答2:

9.4269e+157

要精确的结果的话就是94269001683709979260859834124473539872070722613982672442938359305624678223479506023400294093599136466986609124347432647622826870038220556442336528920420940313

回答3:

#include
double JC(int i)
{
int j;
double k=1;
for(j=i;j>=1;j--)
{
k=j*k;
}
return k;
}
void main()
{
int i;
double sum=0;
for(i=1;i<=100;i++)
{
sum+=JC(i);
}
cout<<"sum="<}

回答4:

是不是79100505