//10!+9!+8!+7!+6!+5!+4!+3!+2!+1! long sum = 0; for (int i = 1; i <= 10; i++) { long k = 1; //此数用来保存i的阶乘 for (int j = 1; j <= i; j++) { k = k*j; } sum += k; } System.out.println("结果是:" + sum);
版权声明:本文为博主原创文章,未经博主允许不得转载。