Skip to content

Latest commit

 

History

History
21 lines (19 loc) · 253 Bytes

25.md

File metadata and controls

21 lines (19 loc) · 253 Bytes

题目:求1+2!+3!+...+20!的和。

#include<stdio.h>

int main()
{
	double sum = 0.0;
	for (int i = 1; i <= 20; ++i)
	{
		double tmp = 1;
		for (int j = 1; j <= i; ++j)
		{
			tmp *= j;
		}
		sum += tmp;
	}
	printf("%lf", sum);

	return 0;
}