填空题

请补充main函数,该函数的功能是:求1+21+3!+…+N!的和。 例如, 1+2!+3!+...+5!+6!的和为873。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。 试题程序: #include <stdio.h> main ( ) { int i, n; long s=0, t=l; clrscr (); printf ("\nInput n: \n"); scanf ("%d", 【1】 ); for (i=l; i<=n; i++) { t= 【2】 ; s= 【3】 ; } printf ("1 ! +2 ! +3 !... +%d! =%ld\n", n, s); }

【参考答案】

&n (2)t*I , (3)s+t
热门 试题