C-study/04/3/3.c

18 lines
172 B
C
Raw Permalink Normal View History

2021-11-04 16:59:48 +00:00
#include<stdio.h>
int main(){
int n;
double a=1,sum=1;
scanf("%d",&n);
for(int i=1;i<=n;i++){
a *= i;
sum += 1/a;
}
printf("%.10lf",sum);
return 0;
}