题目:http://acm.hdu.edu.cn/showproblem.php?pid=1012
注意一下中间数据的保存,和最后结果的输出...
#include <stdio.h>
int main()
{
printf("n e\n");
printf("- -----------\n");
printf("0 1\n");
printf("1 2\n");
printf("2 2.5\n");
int a;
double sum=2.5,fe=0.5;
for(int i=3;i<=9;i++)
{
fe=fe*(1.0/i);
sum+=fe;
printf("%d %.9lf\n",i,sum);
}
return 0;
}