游客 Signup | Login
中文 | En

3414 - 考试十九 求阶乘和

通过次数

0

提交次数

0

Time Limit : 1 秒 Memory Limit : 128 MB

求1!,2!,3!,4!,5!,6!的和,要求分别显示结果,最后输出阶乘的和!

Input

Output

输出6行表示对应的阶乘。

1!+2!+3!+...+N!的和,另占一行。

Examples

Input Format

no input needed

Output Format

1
2
6
24
120
720
Sn=873

Solution C

#include <stdio.h>
#include <stdlib.h>
int main()
{
	int a,b,i;
	a=1;
	b=0;
	for (i=1;i<7;i++)
	{a=a*i;
	 b=a+b;
	 printf("%d\n",a);
	}
	printf("Sn=%d",b-2);

	return 0;
}