计算1!+2!+.....+20!的和
2016-03-15 22:50
274 查看
public class Sun {
public static void main(String[] args) {
long result = 0;
long sum = 1;
int i = 1;
for(i = 1; i <=20; i++)
{
sum = sum * i;
result += sum;
}
System.out.println("result="+result);
}
}
public static void main(String[] args) {
long result = 0;
long sum = 1;
int i = 1;
for(i = 1; i <=20; i++)
{
sum = sum * i;
result += sum;
}
System.out.println("result="+result);
}
}
相关文章推荐
- C++ 虚函数表解析
- 17. Letter Combinations of a Phone Number LeetCode
- Aizu - 0189 Convenient Location(floyd)
- Spring常用注解
- 217. Contains Duplicate
- liunx系统下 锐捷使用以及虚拟拨号教程
- 统计细胞数量
- 基于windows IIS的C语言CGI WEB服务器环境搭建
- 算导--7-2-b.构造新的PARTITION'(A, p, r)
- Struts2 中 模板驱动ModelDriven
- JavaWeb不用选择结构直接引用资源文件
- JNI 实战全面解析
- Android性能优化系列
- JS_原型链
- Verilog阶乘器
- Eclipse快捷键Assign to local variable
- SVM算法教科书(一)
- 高斯分布_三种类别
- Block传值原理
- JS_原型