C语言之求阶乘的和

//计算 一到十 阶乘的和
#include <stdio.h>
void main()
{
	int i=1;
	int j=1;
	int sum=1;
	double sum1=0;
	while(i<=10)
	{
		
		while(j<=i)
		{
          sum=sum*j;
		  j++;
		 
		}
		 printf(" %d! is %d\n",i,sum);
         sum1+=sum; 
		 i++;
		
	}
	 printf("the last result is %lf\n",sum1);
}

  

posted @ 2013-10-26 23:09  云,不忘初心  阅读(930)  评论(0编辑  收藏  举报