#include<iostream>
#include<stdio.h>
using namespace std;
int jiechen(int n){
int i;
int ans=1;
for(i=1;i<=n;i++)
ans*=i;
return ans;
}
int main(){
int n,e;
int i;
cout<<"n e"<<endl;
cout<<"- -----------"<<endl;
double sum=2.5;
printf("0 1\n");
printf("1 2\n");
printf("2 2.5\n");
for(i=3;i<=9;i++){
cout<<i<<" ";
sum+=1.0/jiechen(i);
printf("%.9lf\n",sum);
}
return 0;
}
时间: 2024-09-30 21:29:29