#define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> int main( ) { int i = 1; int num = 1; int x = 0; int sum = 0; for (x = 1; x <= 10; x++) { while (i <= x) { num=num* i; i++; } sum += num;//将每次求的阶乘加起来 } printf("while循环,1-10阶乘的和是%d\n",sum );return 0; }
标签:include,语言,int,代码,练习,main From: https://www.cnblogs.com/ayue6/p/17740920.html