Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这个哪里错了啊?我真的好纳闷。。。

Posted by quanzhimeng at 2009-11-19 16:33:10 on Problem 1517 and last updated at 2009-11-19 16:33:19
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator