C语言编程求若干个连续整数的阶乘之和:1!+2!+3!+....+n!,要求求每个数的阶乘用函数来实现
C语言编程求若干个连续整数的阶乘之和:1!+2!+3!+....+n!,要求求每个数的阶乘用函数来实现
日期:2017-12-16 11:48:45 人气:1
#include"stdio.h"int mul(int n);void main(){ int i, n, num = 0; printf("输入待连续阶乘并求和的整数个数为:"); scanf("%d", &n); for (i = 1; i <= n; i++) num += mul(i); printf("1!+2!+3!+....+n!=%d\n", num);//这里printf()