用C语言求阶乘分数和
求 1+1!/2!+.....+14!/15! 新手求指引!!!
程序代码:
//1 + 1/2 + 1/3 + ... + 1/15 #include <stdio.h> //f(n) = An * (1+n*f(n-1)) double recursion(int amount) { if (1 == amount) { return 1.0; } else { return (amount*recursion(amount-1)+1)/amount; } } int main(void) { printf ("%6.6f\n", recursion(3)); return 0; }