解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class 阶乘求和 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
long temp = 1 ;
long sum = 0;
for (int i = 1; i <= n; i++) {
temp *= i;
sum += temp;
}
System.out.println(sum);
}
}
0.0分
1 人评分
钟神赛车 (C++代码)浏览:905 |
C语言训练-排序问题<1> (C++代码)浏览:632 |
A+B for Input-Output Practice (V) (C++代码)浏览:485 |
A+B for Input-Output Practice (VI) (C++代码)浏览:445 |
简单的a+b (C++语言代码)浏览:895 |
打水问题 (C语言代码)浏览:1148 |
C语言训练-数字母 (C语言代码)浏览:648 |
A+B for Input-Output Practice (VI) (C语言代码)浏览:575 |
1054题解浏览:516 |
C语言程序设计教程(第三版)课后习题7.3 (C语言代码)浏览:420 |