| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
怎么哇掉的#include<stdio.h>
#include<math.h>
int factor(int n);
int main()
{
int i;
long double e=0.000000000;
printf("n e\n");
printf("- -----------\n");
for(i=0;i<10;i++)
{
e+=(double)1/(factor(i));
printf("%d %.10g\n",i,e);
}
return 0;
}
int factor(int n)
{
long sum=1,i;
if(n==0||n==1)
return 1;
else
for(i=1;i<=n;i++)
sum*=i;
return sum;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator