15.计算1!+2!+3!+.....20!=?
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 int main() 5 { 6 double i,k=1,sum=0; //计算1!+2!+3!+.....20!=? 7 for(i=1;i<=20;i++) //k=k*i;sum=sum+k; 8 { 9 k *= i; 10 sum += k; 11 } 12 printf("%22.15e\n",sum); 13 return 0; 14 }