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 kruphy at 2010-03-28 11:02:47 on Problem 1517
#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:
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