1/1! + 2/2! + 3/3!

 avatar
user_3763047219
c_cpp
2 years ago
180 B
2
Indexable
Never
#include <stdio.h>
int main()
{
	int n;
	double out=0,fact=1;
	scanf("%d", &n);
	for (int i = 1;i <= n; i++) {
		fact = fact * i;
		out = out + i / fact;
	}
	printf("%.5f", out);
}