| ||||||||||
| 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 <stdlib.h>
int main()
{
int n,i;
double e;
printf("n e\n- -----------\n");
printf("0 1\n");
printf("1 2\n");
printf("2 2.5\n");
for(n=3;n<=9;n++)
{
e=0;
for(i=0;i<=n;i++)
{
e+=(double)(1.0/(Factorial(i)));
}
printf("%d %.9lf\n",n,e);
}
return 0;
}
int Factorial(int n)
{
int i,fac;
fac=1;
for(i=1;i<=n;i++)
{
fac*=i;
}
return fac;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator